Replace .env* with .kamal/env*
By default look for the env file in .kamal/env to avoid clashes with other tools using .env. For now we'll still load .env and issue a deprecation warning, but in future we'll stop reading those.
This commit is contained in:
committed by
Donal McBreen
parent
0b5506f6f2
commit
5c4c33e0a8
@@ -183,11 +183,25 @@ class Kamal::Cli::Main < Kamal::Cli::Base
|
||||
option :skip_push, aliases: "-P", type: :boolean, default: false, desc: "Skip .env file push"
|
||||
def envify
|
||||
if destination = options[:destination]
|
||||
env_template_path = ".env.#{destination}.erb"
|
||||
env_path = ".env.#{destination}"
|
||||
env_template_path = ".kamal/env.#{destination}.erb"
|
||||
env_path = ".kamal/env.#{destination}"
|
||||
else
|
||||
env_template_path = ".env.erb"
|
||||
env_path = ".env"
|
||||
env_template_path = ".kamal/env.erb"
|
||||
env_path = ".kamal/env"
|
||||
end
|
||||
|
||||
unless Pathname.new(File.expand_path(env_template_path)).exist?
|
||||
if destination = options[:destination]
|
||||
env_template_path = ".env.#{destination}.erb"
|
||||
env_path = ".env.#{destination}"
|
||||
else
|
||||
env_template_path = ".env.erb"
|
||||
env_path = ".env"
|
||||
end
|
||||
|
||||
if Pathname.new(File.expand_path(env_template_path)).exist?
|
||||
warn "Loading #{env_template_path} from the project root is deprecated, use .kamal/env[.<DESTINATION>].erb instead"
|
||||
end
|
||||
end
|
||||
|
||||
if Pathname.new(File.expand_path(env_template_path)).exist?
|
||||
|
||||
Reference in New Issue
Block a user