dotenv: enable overriding danbooru_local_config.rb with env vars.
This commit is contained in:
@@ -502,4 +502,16 @@ module Danbooru
|
|||||||
def aws_sqs_archives_url
|
def aws_sqs_archives_url
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class EnvironmentConfiguration
|
||||||
|
def method_missing(method, *args)
|
||||||
|
var = ENV["DANBOORU_#{method.to_s.upcase}"]
|
||||||
|
|
||||||
|
if var.present?
|
||||||
|
var
|
||||||
|
else
|
||||||
|
CustomConfiguration.new.send(method, *args)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ require "#{Rails.root}/config/danbooru_local_config"
|
|||||||
|
|
||||||
module Danbooru
|
module Danbooru
|
||||||
def config
|
def config
|
||||||
@configuration ||= CustomConfiguration.new
|
@configuration ||= EnvironmentConfiguration.new
|
||||||
end
|
end
|
||||||
|
|
||||||
module_function :config
|
module_function :config
|
||||||
|
|||||||
Reference in New Issue
Block a user