credentials.yml file or via environmental variables.
Environmental variables
Environment variables are a great way to configure a Rails application that needs to run in multiple environments.Secret variables
Environment variables that have sensitive data in them, like aDATABASE_URL that contains a password, can be kept in a secret that can’t be viewed except when the container is running.
To set a secret in Fly, run:
Non-sensitive variables
Variables that don’t have sensitive data can be set in thefly.toml file under the [env] directive. An example file might look like:
View the variables
To view the environment variables of your Fly Rails app, run:fly secrets, the [env] directive in the fly.toml file, and the environment directive from your Dockerfile.
Encrypted credentials file
Another approach to managing credentials in Rails is to use an encrypted credentials file, such asconfig/credentials.yml.enc or config/credentials/production.yml.enc, which you can learn more about by running the following from the root of your Rails application:
RAILS_MASTER_KEY that will decrypt the credentials file can be set via fly secrets set. For example, if your master key is stored in config/master.key, you can run: