diff options
| author | Dawid Rycerz <dawid@rycerz.xyz> | 2025-07-22 15:08:37 +0300 |
|---|---|---|
| committer | Dawid Rycerz <dawid@rycerz.xyz> | 2025-07-22 15:08:37 +0300 |
| commit | fcc2f4704e39b0e69b377cc138f75027721dac22 (patch) | |
| tree | 732fc94b354a26c08fba9cc9059f9c6c900182be /vendor/integration/utils/loadConfig.ts | |
Initial template
Diffstat (limited to 'vendor/integration/utils/loadConfig.ts')
| -rw-r--r-- | vendor/integration/utils/loadConfig.ts | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/vendor/integration/utils/loadConfig.ts b/vendor/integration/utils/loadConfig.ts new file mode 100644 index 0000000..8dfb435 --- /dev/null +++ b/vendor/integration/utils/loadConfig.ts @@ -0,0 +1,16 @@ +import fs from 'node:fs'; +import yaml from 'js-yaml'; + +const loadConfig = async (configPathOrData: string | object) => { + if (typeof configPathOrData === 'string') { + const content = fs.readFileSync(configPathOrData, 'utf8'); + if (configPathOrData.endsWith('.yaml') || configPathOrData.endsWith('.yml')) { + return yaml.load(content); + } + return content; + } + + return configPathOrData; +}; + +export default loadConfig; |
