Overhauled configuration so that it's a bit more useful in more spots; configuration now properly loads an environment config as well as defaults; updated some woodpecker config
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -6,11 +6,13 @@ require 'yaml'
|
||||
class Config
|
||||
|
||||
DEFAULT_CONFIG = 'config/defaults.yaml'
|
||||
ENVIRONMENT_CONFIG = ENV.fetch('RACK_ENV', 'development')
|
||||
|
||||
def initialize(config_path)
|
||||
def initialize(config_path = "config/#{ENVIRONMENT_CONFIG}.yaml")
|
||||
@data = YAML.load_file(DEFAULT_CONFIG)
|
||||
|
||||
# merge in user-defined configuration if it exists
|
||||
puts "Merging #{config_path} with #{DEFAULT_CONFIG}."
|
||||
@data.merge!(YAML.load_file(config_path)) if File.exist?(config_path)
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user