Module: Arisu

Defined in:
lib/arisu.rb,
lib/arisu/cli.rb,
lib/arisu/version.rb

Defined Under Namespace

Classes: CLI

Constant Summary collapse

GCP_ENV_KEYS =
%w[
  GOOGLE_CLOUD_PROJECT
  GOOGLE_CLOUD_CREDENTIALS
  GOOGLE_CLOUD_KEYFILE
  GCLOUD_KEYFILE
  GOOGLE_CLOUD_CREDENTIALS_JSON
  GOOGLE_CLOUD_KEYFILE_JSON
  GCLOUD_KEYFILE_JSON
].freeze
VERSION =
'1.0.1'

Class Method Summary collapse

Class Method Details

.load(*filenames, secret_manager: nil, project_id: nil) ⇒ Object



20
21
22
23
24
25
# File 'lib/arisu.rb', line 20

def load(*filenames, secret_manager: nil, project_id: nil)
  env = Dotenv.parse(*filenames)
  GCP_ENV_KEYS.each {|e| ENV[e] ||= env[e] if env.key?(e)}
  decrypt!(env, secret_manager: secret_manager, project_id: project_id)
  env.each {|k, v| ENV[k] ||= v}
end

.load!(*filenames, secret_manager: nil, project_id: nil) ⇒ Object



27
28
29
30
31
32
# File 'lib/arisu.rb', line 27

def load!(*filenames, secret_manager: nil, project_id: nil)
  env = Dotenv.parse!(*filenames)
  GCP_ENV_KEYS.each {|e| ENV[e] ||= env[e] if env.key?(e)}
  decrypt!(env, secret_manager: secret_manager, project_id: project_id)
  env.each {|k, v| ENV[k] ||= v}
end

.overload(*filenames, secret_manager: nil, project_id: nil) ⇒ Object



34
35
36
37
38
39
# File 'lib/arisu.rb', line 34

def overload(*filenames, secret_manager: nil, project_id: nil)
  env = Dotenv.parse(*filenames)
  GCP_ENV_KEYS.each {|e| ENV[e] = env[e] if env.key?(e)}
  decrypt!(env, secret_manager: secret_manager, project_id: project_id)
  env.each {|k, v| ENV[k] = v}
end

.overload!(*filenames, secret_manager: nil, project_id: nil) ⇒ Object



41
42
43
44
45
46
# File 'lib/arisu.rb', line 41

def overload!(*filenames, secret_manager: nil, project_id: nil)
  env = Dotenv.parse!(*filenames)
  GCP_ENV_KEYS.each {|e| ENV[e] = env[e] if env.key?(e)}
  decrypt!(env, secret_manager: secret_manager, project_id: project_id)
  env.each {|k, v| ENV[k] = v}
end