how to change enviroment by command line.
mkillua opened this issue · 1 comments
mkillua commented
Hi guys, thanks for your project. I'm using on my development and i can't change my environment by command line. for example : my default environment is development but i can change it by command line. is possible ? for example : php vendor/sokil/php-mongo-migrator/bin/mongo-migrator migrate --environment production
Thanks for your time.
sokil commented
For example you gave next migration config:
default_environment: development
path:
migrations: migrations
environments:
env:
dsn: "%env(MONGO_DSN)%"
default_database: test
log_database: test
log_collection: migrations
development:
dsn: mongodb://dev:7777
default_database: test
log_database: test
log_collection: migrations
staging:
dsn: mongodb://stage:8888
default_database: test
log_database: test
log_collection: migrations
production:
dsn: mongodb://prod:9999
default_database: test
log_database: test
log_collection: migrations
You can define any environment:
root@8a0460872fcb:/phpmongo/share/test# ../../bin/mongo-migrator migrate -e development
Environment: development
In Client.php line 203:
Failed to connect to: dev:7777: php_network_getaddresses: getaddrinfo failed: Name or service not known
root@8a0460872fcb:/phpmongo/share/test# ../../bin/mongo-migrator migrate -e staging
Environment: staging
In Client.php line 203:
Failed to connect to: stage:8888: php_network_getaddresses: getaddrinfo failed: Name or service not known
If environment not defined, will be used default_environment
from config.