feat: support for configuring postal with environment variables

This commit is contained in:
Adam Cooke
2024-01-30 13:11:56 +00:00
parent 990b575902
commit 854aa5ebc8
2 changed files with 93 additions and 92 deletions
+6 -1
View File
@@ -1,3 +1,4 @@
require "erb"
require "yaml"
require "pathname"
require "cgi"
@@ -78,7 +79,11 @@ module Postal
end
def self.defaults
@defaults ||= YAML.load_file(defaults_file_path)
@defaults ||= begin
file = File.read(defaults_file_path)
yaml = ERB.new(file).result
YAML.safe_load(yaml)
end
end
def self.database_url