Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command line flags should override config options #571

Closed
twavv opened this issue Feb 26, 2020 · 2 comments · Fixed by #585
Closed

Command line flags should override config options #571

twavv opened this issue Feb 26, 2020 · 2 comments · Fixed by #585

Comments

@twavv
Copy link

twavv commented Feb 26, 2020

Currently, it looks like flags specified in config.json override flags specified on the command line.

SCHEMA = json[schemaArg] || SCHEMA
CREATE_SCHEMA = json[createSchemaArg] || CREATE_SCHEMA
MIGRATIONS_DIR = json[migrationsDirArg] || MIGRATIONS_DIR
MIGRATIONS_SCHEMA = json[migrationsSchemaArg] || MIGRATIONS_SCHEMA
CREATE_MIGRATIONS_SCHEMA = json[createMigrationsSchemaArg] || CREATE_MIGRATIONS_SCHEMA
MIGRATIONS_TABLE = json[migrationsTableArg] || MIGRATIONS_TABLE
MIGRATIONS_FILE_LANGUAGE = json[migrationFileLanguageArg] || MIGRATIONS_FILE_LANGUAGE
CHECK_ORDER = typeof json[checkOrderArg] !== 'undefined' ? json[checkOrderArg] : CHECK_ORDER
IGNORE_PATTERN = json[ignorePatternArg] || IGNORE_PATTERN
DECAMELIZE = typeof json[decamelizeArg] !== 'undefined' ? json[decamelizeArg] : DECAMELIZE

Since the command-line flag handling happens earlier, should probably be

SCHEMA = SCHEMA || json[schemaArg]
// etc.
@dolezel
Copy link
Contributor

dolezel commented Mar 3, 2020

True, command line options should have precedence. How is it that I didn't notice? 🤔

@dolezel
Copy link
Contributor

dolezel commented Mar 30, 2020

I had some time today to look at it, but it turns more complicated as yargs now defines default values for boolean flags. Which will not be possible to override.
I will need to investigate it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants