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

Configuration defaultEnv default value is not readed #769

Open
1 task done
exejutable opened this issue Feb 22, 2022 · 0 comments
Open
1 task done

Configuration defaultEnv default value is not readed #769

exejutable opened this issue Feb 22, 2022 · 0 comments

Comments

@exejutable
Copy link

exejutable commented Feb 22, 2022

I'm submitting a...

  • Bug report

Current behavior

Default value for property defaultEnv is not read

Expected behavior

If the env variable is not declared use the default value

Minimal reproduction of the problem with instructions

With this configuration

{
  "defaultEnv": {
    "default": "development",
    "ENV": "SSO_DB_ENVIRONMENT"
  },
  "sql-file": true,
  "multipleStatements": true,
  "development": {
    "driver": "mysql",
    "user": "root",
    "password": "password",
    "host": "localhost",
    "port": "3306",
    "sql-file": true,
    "multipleStatements": true
  },
  "production": {
    "driver": "mysql",
    "user": {
      "ENV": "SSO_DB_USERNAME"
    },
    "password": {
      "ENV": "SSO_DB_PASSWORD"
    },
    "host": {
      "ENV": "SSO_DB_HOST"
    },
    "port": {
      "ENV": "SSO_DB_PORT"
    },
    "sql-file": true,
    "multipleStatements": true
  }
}

I run:

db-migrate --config ./database-creation.json db:create sso

Return a exit code 1 with this error:

[ERROR] Error: Environment(s) '' not found.
    at Config.exports.setCurrent (D:\projects\dg\sso-service\node_modules\db-migrate\lib\config.js:23:11)      
    at Object.exports.loadObject (D:\projects\dg\sso-service\node_modules\db-migrate\lib\config.js:183:11)     
    at Object.exports.loadFile (D:\projects\dg\sso-service\node_modules\db-migrate\lib\config.js:94:18)        
    at loadConfig (D:\projects\dg\sso-service\node_modules\db-migrate\lib\commands\helper\load-config.js:12:18)
    at new dbmigrate (D:\projects\dg\sso-service\node_modules\db-migrate\api.js:77:43)
    at Object.module.exports.getInstance (D:\projects\dg\sso-service\node_modules\db-migrate\index.js:85:10)   
    at D:\projects\dg\sso-service\node_modules\db-migrate\bin\db-migrate:32:25
    at D:\projects\dg\sso-service\node_modules\resolve\lib\async.js:142:25
    at maybeRealpath (D:\projects\dg\sso-service\node_modules\resolve\lib\async.js:50:9)
    at D:\projects\dg\sso-service\node_modules\resolve\lib\async.js:138:24
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Environment


db-migrate version: 0.11.13
mysql: 2.2.0
Additional information:
- Node version: v16.13.1
- Platform:  Windows 10

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

No branches or pull requests

1 participant