Skip to content

Commit

Permalink
⚙️ Changed the logic for loading settings (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
leonovk authored May 14, 2024
1 parent e8b4ddb commit 7482458
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.1.5
v0.1.6
7 changes: 5 additions & 2 deletions config/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@
Dotenv.load
rescue LoadError # rubocop:disable Lint/SuppressedException
end
# NOTE: in development mode, settings should be loaded after loading environment variables
Config.load_and_set_settings('config/settings/development.yaml')
end

Config.load_and_set_settings('config/settings.yaml')

if ENV.fetch('ENVIRONMENT', 'development') == 'production'
# NOTE: It is important that the settings are loaded at the beginning
Config.load_and_set_settings('config/settings/production.yaml')

conf = "#{Settings.wg_path}/wg0.conf"
system('wg-quick up wg0') if File.exist?(conf)
end
Expand Down
12 changes: 12 additions & 0 deletions config/settings/development.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
wg_path: <%= ENV['WG_PATH'] || 'etc' %>
wg_device: <%= ENV['WG_DEVICE'] || 'eth0' %>
wg_default_address: <%= ENV['WG_DEFAULT_ADDRESS'] || '10.8.0.x' %>
wg_allowed_ips: <%= ENV['WG_ALLOWED_IPS'] || '0.0.0.0/0, ::/0' %>
wg_host: <%= ENV['WG_HOST'] || '0.0.0.0' %>
wg_port: <%= ENV['WG_PORT'] || '51820' %>
wg_default_dns: <%= ENV['WG_DEFAULT_DNS'] || '1.1.1.1' %>
wg_pre_up: <%= ENV['WG_PRE_UP'] || '' %>
wg_pre_down: <%= ENV['WG_PRE_DOWN'] || '' %>
wg_post_up: <%= ENV['WG_POST_UP'] %>
wg_post_down: <%= ENV['WG_POST_DOWN'] %>
wg_persistent_keepalive: <%= ENV['WG_PERSISTENT_KEEPALIVE'] || 0 %>
File renamed without changes.

0 comments on commit 7482458

Please sign in to comment.