-
Notifications
You must be signed in to change notification settings - Fork 482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Specify env file + envify on the config file #825
base: main
Are you sure you want to change the base?
Conversation
…ode is to force a environment there
elsif envify_from_config = KAMAL.config.raw_config["envify"] | ||
env_template_path = ".env.#{envify_from_config}.erb" | ||
env_path = ".env.#{envify_from_config}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can extract this to his own PR.
delegate :argumentize, to: Kamal::Utils | ||
|
||
def self.from_config(config:, secrets_file: nil) | ||
secrets_keys = config.fetch("secret", []) | ||
clear = config.fetch("clear", config.key?("secret") || config.key?("tags") ? {} : config) | ||
env_key_config = config.class == Kamal::Configuration ? config.env : config.fetch("env", {}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "config" variable name is not too clear to what this represents. This is not "config", this is the "env" key from config with this values. Maybe we can also extract this to his own PR also?
# TODO: More than one @env_file | ||
# TODO: Considerer a merge between env_file and env | ||
if @env_file | ||
Dotenv::Environment.new(@env_file) | ||
else | ||
secrets_keys.to_h { |key| [ key, ENV.fetch(key) ] } | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the main goal. Not sure how we can tackle this.
The reason behind this is to push an env file with "gazillions" of environment variables that can be related to the application code or not.
Any thoughts @djmb ? (sorry to tag you, but I saw that you did the last merges around here)
My main goal is to upload a custom env, entirely to the app or accessory.
Some projects have the
.env
committed inside of the git repository, and some of them have so much env that update his values, remove the keys or add new ones without changing the application code.Also I put the "for_node" and "custom_env" to debug and understand the gem.
Lack of tests.
This is more a PR to discuss an approach rather than something ready to merge.