Configuration Files

After you have installed the CLI, you will need to configure the different environments.

What is a configuration file?

Think of the Hasura CLI as a command-line database client. Normally, with database clients you need to provide the URL of the database, the name of the database you want to use, the user you want to authenticate as, etc.

In this sense, Hasura is no different. It also needs to know where the Hasura servers are and it needs to be able to authenticate (among other things). To accomplish this, Hasura provides different mechanisms including env files and CLI flags, but our choice is to use YAML files.

Context: The configuration files are generated by running the hasura init command, this is not necessary for you, since we already have created them for this project.

The local configuration file

There can be one configuration file for each environment, but we only need to have one file called config.yaml which is in the moped-database root directory. It follows the following format:

version: 2
endpoint: http://localhost:8080
metadata_directory: metadata
actions:
  kind: synchronous
  handler_webhook_baseurl: http://localhost:3000

Production & Staging configuration files

The name would stay the same (config.yaml) but there would be some differences in the contents of that file, in staging for example:

version: 2
endpoint: https://moped-graphql-staging.austinmobility.io
metadata_directory: metadata
admin_secret: <secret_here>
actions:
  kind: synchronous
  handler_webhook_baseurl: https://moped-graphql-staging.austinmobility.io

Please note that this is for documentation purposes only, you may take a look to staging or production, but under no circumstances you need to make changes directly to staging and production, this can cause the environments to be out of sync and break the migrations system, you would be in the hook for a serious headache and the users would be unable to use moped.

Last updated