Skip to content

Commit

Permalink
fix(cli): omit defaultConnection if connectionString is defined
Browse files Browse the repository at this point in the history
  • Loading branch information
aleclarson committed Sep 8, 2022
1 parent 4e2fd79 commit f38c853
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/tusken-cli/src/config.ts
Expand Up @@ -34,7 +34,11 @@ export function loadConfig(configPath?: string, database?: string) {
const load = jiti(__filename, { interopDefault: true, esmResolve: true })
config = load(path.resolve(configPath))
if (config) {
config.connection = { ...defaultConnection, ...config.connection }
// The connectionString option is overridden by the other options,
// so we need to omit the defaultConnection in that case.
if (!config.connection?.connectionString) {
config.connection = { ...defaultConnection, ...config.connection }
}
cwd = path.dirname(configPath)
}
}
Expand All @@ -47,9 +51,6 @@ export function loadConfig(configPath?: string, database?: string) {

if (database) {
config.connection.database = database
} else if (!config.connection.database) {
console.error('The --database option is required')
process.exit(1)
}

config.schemaDir = config.schemaDir
Expand Down

0 comments on commit f38c853

Please sign in to comment.