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

This commit is contained in:
2025-08-12 23:47:38 -04:00
parent 164eea1bde
commit eeedc57cd3
9 changed files with 42 additions and 13 deletions

View File

@@ -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