Local Development: Ruby, .NET and Rust
The pattern is the same in every language: put ennote secret get "<secret>" -- in front of the command that starts your app, and read the values as environment variables.
The examples use a secret named api-env. Set your organization and workspace once with ennote config set, or add --organization-id and --workspace-id flags as in the overview.
Ruby on Rails
ennote secret get "api-env" -- bin/rails server
If you use bin/dev to start several processes, start it through Ennote and every process inherits the variables:
ennote secret get "api-env" -- bin/dev
Read values with ENV:
Stripe.api_key = ENV.fetch("STRIPE_SECRET_KEY")
A key named DATABASE_URL is used by Active Record automatically. ENV.fetch raises an error when a key is missing, so a misconfigured secret fails at start-up instead of later.
ASP.NET Core and .NET
ennote secret get "api-env" -- dotnet run
ennote secret get "api-env" -- dotnet watch
The default configuration reads environment variables, and a double underscore (__) stands for the : separator. Name the keys of your Ennote secret accordingly:
| Key in Ennote | Configuration key |
|---|---|
ConnectionStrings__Default | ConnectionStrings:Default |
Stripe__SecretKey | Stripe:SecretKey |
var connectionString = builder.Configuration.GetConnectionString("Default");
var stripeKey = builder.Configuration["Stripe:SecretKey"];
This replaces local appsettings.Development.json secrets and .NET User Secrets.
Rust
ennote secret get "api-env" -- cargo run
With live reload through bacon or cargo watch, start the watcher through Ennote:
ennote secret get "api-env" -- bacon run
Read values with std::env::var:
let database_url = std::env::var("DATABASE_URL").expect("DATABASE_URL is not set");
If you use dotenvy, you can keep dotenvy::dotenv().ok() while you migrate. It does not override variables that are already set.
Any Other Language
If your language can read environment variables, it works with Ennote. Find the command that starts your app and run it as:
ennote secret get "<secret>" -- <your command>
Need Help?
If you encounter any issues or have questions, don't hesitate to contact support. Our team is here to assist you with any challenges you might face.
PHP
Run Laravel, Symfony and plain PHP apps locally with secrets from Ennote instead of a .env file, by starting php artisan serve, the PHP built-in server or Composer scripts with ennote secret get.
Overview
How to use Ennote secrets in any CI/CD system: store one Ennote token in the CI tool, install the Ennote CLI in the job, and inject secrets into build, test and deploy commands with ennote secret get.