-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Managing multiple servers from cli #326
Comments
@shahidhk we do not want to have multiple environments in the same config file? |
@0x777 Possible. But we cannot do this without breaking existing setup or introducing versioning for config file. If we are to have different environments in the same file, it could look like this: # config.yaml
version: v1.0
environments:
- name: staging
endpoint: https://staging-endpoint.com
migrations_dir: migrations
- name: production
endpoint: https://production-endpoint.com
migrations_dir: migrations And commands will be: hasura --environment staging console
hasura --environment production migrate apply The current config.yaml will be version |
Do you think it'll be simpler just to have multiple conf files? By the way, for now, you can always override the conf file by passing the right values as flags right? |
@coco98 Implementation is simpler for multiple config files. Yes, endpoint can be over-ridden by passing it as a flag or env var as of now. |
As a user I think I like more the possibility to have different environments in the same file and specify the env in the cli command. |
@pradel You can provide endpoint/access key in 3 different ways
This precedence is flag > env var > config file |
@shahidhk Thanks that what I was looking for! |
@pradel It comes up for the relevant commands as its not a global flag. `hasura console --help`Run a web server to serve Hasura Console for GraphQL Engine to manage database and build queries
Usage:
hasura console [flags]
Examples:
# Start console:
hasura console
# Start console on a different address and ports:
hasura console --address 0.0.0.0 --console-port 8080 --api-port 8081
Flags:
--access-key string access key for Hasura GraphQL Engine
--address string address to use (default "localhost")
--api-port string port for serving migrate api (default "9693")
--console-port string port for serving console (default "9695")
--endpoint string http(s) endpoint for Hasura GraphQL Engine
-h, --help help for console
--no-browser do not automatically open console in browser
--static-dir string directory where static assets mentioned in the console html template can be served from
Global Flags:
--project string hasura project directory where the commands should be executed. (default: current directory) |
@shahidhk Okay I see, I tried only the |
@shahidhk is this feature being implemented? (multiple environments in either a single file or multiple files) I guess |
I wrote this bash script to help me manage this so I don't accidentally push to the wrong server. hasura-export
but yeah, it would be nice if this support multiple envs |
When I use
But when I use |
Hey @denis-ryzhkov , correct me if I got it wrong, but this is what I understood. You are running a hasura instance with a docker-compose file which is similar to the following, Docker compose file
Now, you created a project
and you are trying to run let's say the console command
This is working since we have The you created another project with a similar docker-compose file but exposing the server at If that's the case you can try
|
Hey @scriptonist , thank you for explanation I want to configure Hasura via environment variables only, in a DRY way, Now I see My question is solved, thank you! |
This issue has not attracted significant attention for a long period of time, and since alternatives are available, we are closing this. |
V3_GIT_ORIGIN_REV_ID: c2868238d43045e65b30df4dff4bc909a4999a17
There could be scenarios where a user is dealing with staging and production environments. Development work happens in staging and and then it is pushed to production.
Right now, to switch servers and apply migrations on a different server,
endpoint
insideconfig.yaml
has to be edited.Instead if the CLI could take a flag
--config-file=<file-name>
, these switches can be made quickly, just by keeping two files and switching them in the command.For example, there are two files,
config-staging.yaml
andconfig-prod.yaml
.The default value for this flag will be
config.yaml
so that the change is backwards compatible.Flag can also be set using an env var
HASURA_GRAPHQL_CLI_CONFIG_FILE
.I also propose to move the name of directory in which migrations are stored into
config.yaml
, instead of hard codedmigrations
. This gives the user flexibility to use the CLI in any directory structure.Config file becomes:
Suggestions/Feedback welcome. Use 👍 👎 reactions.
The text was updated successfully, but these errors were encountered: