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