mirror of
https://git.nadeko.net/Fijxu/invidious.git
synced 2025-12-20 18:08:54 +00:00
Allow providing 12-Factor-style Database URL in config
This commit is contained in:
@@ -173,6 +173,20 @@ struct Preferences
|
||||
end
|
||||
end
|
||||
|
||||
module URIConverter
|
||||
def self.to_yaml(value : URI, yaml : YAML::Nodes::Builder)
|
||||
yaml.scalar value.normalize!
|
||||
end
|
||||
|
||||
def self.from_yaml(ctx : YAML::ParseContext, node : YAML::Nodes::Node) : URI
|
||||
if node.is_a?(YAML::Nodes::Scalar)
|
||||
URI.parse node.value
|
||||
else
|
||||
node.raise "Expected scalar, not #{node.class}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
module ProcessString
|
||||
def self.to_json(value : String, json : JSON::Builder)
|
||||
json.string value
|
||||
|
||||
Reference in New Issue
Block a user