Load destination ENV file also
This commit is contained in:
1
bin/mrsk
1
bin/mrsk
@@ -3,7 +3,6 @@
|
||||
# Prevent failures from being reported twice.
|
||||
Thread.report_on_exception = false
|
||||
|
||||
require "dotenv/load"
|
||||
require "mrsk"
|
||||
|
||||
begin
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
require "thor"
|
||||
require "dotenv"
|
||||
require "mrsk/sshkit_with_ext"
|
||||
|
||||
module Mrsk::Cli
|
||||
@@ -21,10 +22,19 @@ module Mrsk::Cli
|
||||
|
||||
def initialize(*)
|
||||
super
|
||||
load_envs
|
||||
initialize_commander(options)
|
||||
end
|
||||
|
||||
private
|
||||
def load_envs
|
||||
if destination = options[:destination]
|
||||
Dotenv.load(".env.#{destination}", ".env")
|
||||
else
|
||||
Dotenv.load(".env")
|
||||
end
|
||||
end
|
||||
|
||||
def initialize_commander(options)
|
||||
MRSK.tap do |commander|
|
||||
commander.config_file = Pathname.new(File.expand_path(options[:config_file]))
|
||||
|
||||
Reference in New Issue
Block a user