Skip to content

Commit

Permalink
Added support for __FPDSettings & fixed issues with env settings parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
Inrixia committed May 27, 2022
1 parent d2e67d0 commit 352e11b
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 8 deletions.
31 changes: 24 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -15,12 +15,13 @@
"dependencies": {
"@ctrl/plex": "^1.5.3",
"@inrixia/db": "^1.8.0",
"@inrixia/helpers": "^1.23.1",
"@inrixia/helpers": "^1.23.2",
"chalk": "^4.1.2",
"dotenv": "^16.0.1",
"ffbinaries": "^1.1.4",
"floatplane": "^3.2.0",
"html-to-text": "^8.2.0",
"json5": "^2.2.1",
"multi-progress-bars": "^4.2.3",
"process.argv": "^0.6.0",
"prompts": "^2.4.2",
Expand Down
4 changes: 4 additions & 0 deletions src/lib/helpers.ts
Expand Up @@ -6,6 +6,7 @@ import db from '@inrixia/db';
import fs from 'fs';

import 'dotenv/config';
import { parse } from 'json5';

import type { Args, PartialArgs, Settings } from './types';

Expand All @@ -18,6 +19,9 @@ recursiveUpdate(settings, argv, { setUndefined: false, setDefined: true });

const env = getEnv();
rebuildTypes<PartialArgs, Settings & Args>(env, { ...defaultSettings, ...defaultArgs });

if (env.__FPDSettings !== undefined) recursiveUpdate(settings, parse(env.__FPDSettings.replaceAll('\\"', '"')), { setUndefined: false, setDefined: true });

recursiveUpdate(settings, env, { setUndefined: false, setDefined: true });

export const args = { ...argv, ...env };
Expand Down

0 comments on commit 352e11b

Please sign in to comment.