Module: Doppler
- Defined in:
- lib/doppler.rb,
lib/doppler/client.rb,
lib/doppler/version.rb
Defined Under Namespace
Classes: Client
Constant Summary collapse
- VERSION =
"1.0.3".freeze
- @@host_url =
configure doppler host url
"https://deploy.doppler.com"
- @@api_key =
configure api key
ENV["DOPPLER_API_KEY"]
- @@pipeline =
configure pipeline
ENV["DOPPLER_PIPELINE"]
- @@environment =
configure environment
ENV["DOPPLER_ENVIRONMENT"]
- @@ignore_variables =
configure ignore variables
[]
- @@backup_filepath =
configure backup file
nil
- @@env_filepath =
configure env file
".env"
Class Method Summary collapse
- .api_key ⇒ Object
- .api_key=(api_key) ⇒ Object
- .backup_filepath ⇒ Object
- .backup_filepath=(backup_filepath) ⇒ Object
-
.configure {|_self| ... } ⇒ Object
helper to configure above variables.
- .env_filepath ⇒ Object
- .env_filepath=(env_filepath) ⇒ Object
- .environment ⇒ Object
- .environment=(environment) ⇒ Object
- .host_url ⇒ Object
- .host_url=(host) ⇒ Object
- .ignore_variables ⇒ Object
- .ignore_variables=(ignore_variables) ⇒ Object
- .pipeline ⇒ Object
- .pipeline=(pipeline) ⇒ Object
-
.read_env(path) ⇒ Object
read env file.
Class Method Details
.api_key ⇒ Object
18 19 20 |
# File 'lib/doppler.rb', line 18 def self.api_key @@api_key end |
.api_key=(api_key) ⇒ Object
15 16 17 |
# File 'lib/doppler.rb', line 15 def self.api_key=(api_key) @@api_key = api_key end |
.backup_filepath ⇒ Object
54 55 56 |
# File 'lib/doppler.rb', line 54 def self.backup_filepath @@backup_filepath end |
.backup_filepath=(backup_filepath) ⇒ Object
51 52 53 |
# File 'lib/doppler.rb', line 51 def self.backup_filepath=(backup_filepath) @@backup_filepath = backup_filepath end |
.configure {|_self| ... } ⇒ Object
helper to configure above variables.
88 89 90 91 92 93 94 95 |
# File 'lib/doppler.rb', line 88 def self.configure yield(self) env_file = self.read_env(self.env_filepath) || {} self.api_key = self.api_key || env_file["DOPPLER_API_KEY"] self.pipeline = self.pipeline || env_file["DOPPLER_PIPELINE"] self.environment = self.environment || env_file["DOPPLER_ENVIRONMENT"] end |
.env_filepath ⇒ Object
63 64 65 |
# File 'lib/doppler.rb', line 63 def self.env_filepath @@env_filepath end |
.env_filepath=(env_filepath) ⇒ Object
60 61 62 |
# File 'lib/doppler.rb', line 60 def self.env_filepath=(env_filepath) @@env_filepath = env_filepath end |
.environment ⇒ Object
36 37 38 |
# File 'lib/doppler.rb', line 36 def self.environment @@environment end |
.environment=(environment) ⇒ Object
33 34 35 |
# File 'lib/doppler.rb', line 33 def self.environment=(environment) @@environment = environment end |
.host_url ⇒ Object
9 10 11 |
# File 'lib/doppler.rb', line 9 def self.host_url @@host_url end |
.host_url=(host) ⇒ Object
6 7 8 |
# File 'lib/doppler.rb', line 6 def self.host_url=(host) @@host_url = host_url end |
.ignore_variables ⇒ Object
45 46 47 |
# File 'lib/doppler.rb', line 45 def self.ignore_variables @@ignore_variables end |
.ignore_variables=(ignore_variables) ⇒ Object
42 43 44 |
# File 'lib/doppler.rb', line 42 def self.ignore_variables=(ignore_variables) @@ignore_variables = ignore_variables end |
.pipeline ⇒ Object
27 28 29 |
# File 'lib/doppler.rb', line 27 def self.pipeline @@pipeline end |
.pipeline=(pipeline) ⇒ Object
24 25 26 |
# File 'lib/doppler.rb', line 24 def self.pipeline=(pipeline) @@pipeline = pipeline end |
.read_env(path) ⇒ Object
read env file
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/doppler.rb', line 68 def self.read_env(path) if path.nil? or !File.file?(path) return nil end keys = {} File.open(path, "r") do |file| file.each do |line| parts = line.strip.split("=") if parts.length == 2 keys[parts[0].strip] = parts[1].strip end end end return keys end |