diff --git a/VERSION b/VERSION index 02bf650..610220f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v0.1.5 \ No newline at end of file +v0.1.6 \ No newline at end of file diff --git a/config/config.rb b/config/config.rb index 146a379..34a45c6 100644 --- a/config/config.rb +++ b/config/config.rb @@ -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 diff --git a/config/settings/development.yaml b/config/settings/development.yaml new file mode 100644 index 0000000..63f5859 --- /dev/null +++ b/config/settings/development.yaml @@ -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 %> diff --git a/config/settings.yaml b/config/settings/production.yaml similarity index 100% rename from config/settings.yaml rename to config/settings/production.yaml