Local Development

Local Development: Ruby, .NET and Rust

Run Ruby on Rails, ASP.NET Core and Rust apps locally with secrets from Ennote instead of a .env file, by starting them with ennote secret get.

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:

config/initializers/stripe.rb
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 EnnoteConfiguration key
ConnectionStrings__DefaultConnectionStrings:Default
Stripe__SecretKeyStripe:SecretKey
Program.cs
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:

src/main.rs
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.