mirror of
https://git.nadeko.net/Fijxu/invidious.git
synced 2026-01-23 23:31:35 +00:00
Config: Reload configuration on modification
It detects changes on the config.yml automtically if invidious is running on linux. If not, the configuration can be reloaded using `kill -s HUP $(pidof invidious)` or any other tool that sends a SIGHUP signal to the invidious process. Closes #16
This commit is contained in:
@@ -32,6 +32,7 @@ require "yaml"
|
||||
require "compress/zip"
|
||||
require "protodec/utils"
|
||||
require "redis"
|
||||
require "inotify"
|
||||
|
||||
require "./invidious/database/*"
|
||||
require "./invidious/database/migrations/*"
|
||||
@@ -58,7 +59,20 @@ end
|
||||
# Simple alias to make code easier to read
|
||||
alias IV = Invidious
|
||||
|
||||
CONFIG = Config.load
|
||||
CONFIG = Config.load
|
||||
|
||||
Signal::HUP.trap do
|
||||
Config.reload
|
||||
end
|
||||
|
||||
{% if flag?(:linux) %}
|
||||
if CONFIG.reload_config_automatically
|
||||
Inotify.watch("config/config.yml") do |event|
|
||||
Config.reload
|
||||
end
|
||||
end
|
||||
{% end %}
|
||||
|
||||
HMAC_KEY = CONFIG.hmac_key
|
||||
|
||||
PG_DB = DB.open CONFIG.database_url
|
||||
|
||||
Reference in New Issue
Block a user