-
What is the recommended way to set environment variables in Marten? It seems that |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hey! Marten does not prescribe a specific method for utilizing environment variables. Developers can choose their preferred approach, whether it's using a If you want to use require "dotenv"
Dotenv.load?
Marten.configure do |config|
config.secret_key = ENV.fetch("MARTEN_SECRET_KEY") { raise "Missing MARTEN_SECRET_KEY env variable" }
end |
Beta Was this translation helpful? Give feedback.
Hey! Marten does not prescribe a specific method for utilizing environment variables. Developers can choose their preferred approach, whether it's using a
.env
file or any other method, to define environment-specific values. This decision is left to the discretion of developers.If you want to use
.env
files in your project, I would recommend using thecr-dotenv
shard and simply making sure to initialize settings by reading environment variables usingENV
. For example: