21
1
Fork 0
mirror of https://github.com/Evolix/chexpire.git synced 2024-04-26 14:00:50 +02:00

Chexpire custom configuration inherits from defaults configuration.

This commit is contained in:
Colin Darie 2018-08-01 18:38:02 +02:00
parent 1b5ea46d48
commit 2a634d8dda
No known key found for this signature in database
GPG key ID: 4FB865FDBCA4BCC4
8 changed files with 71 additions and 44 deletions

View file

@ -13,9 +13,12 @@ addons:
before_install:
- cp config/database.example.yml config/database.yml
- cp config/chexpire.test.yml config/chexpire.yml
- cp config/secrets.example.yml config/secrets.yml
# Test configuration loaded from chexpire.defaults.yml,
# but chexpire.yml file is required
- touch config/chexpire.yml
install:
- bundle install
- yarn install

View file

@ -38,6 +38,7 @@ gem 'bcrypt', '~> 3.1.7'
gem 'open4'
gem 'naught'
gem 'hashie'
gem 'whenever', require: false

View file

@ -134,6 +134,7 @@ GEM
has_scope (0.7.2)
actionpack (>= 4.1)
activesupport (>= 4.1)
hashie (3.5.7)
i18n (1.0.1)
concurrent-ruby (~> 1.0)
io-like (0.3.0)
@ -354,6 +355,7 @@ DEPENDENCIES
guard
guard-minitest
has_scope
hashie
jbuilder (~> 2.5)
kaminari
launchy

View file

@ -45,11 +45,13 @@ To use elliptic curve SSH keys, we need to have `libsodium` and its headers.
## Rails configuration
After cloning this repository, you have to create and edit a few files from example files, for your local development configuration :
After cloning this repository, you have to create and edit a few files from example or defaults files, for your local development configuration :
- `config/database.yml`
- `config/chexpire.yml`
- `config/secrets.yml`
- `config/chexpire.yml` : set at least the `mailer_default_from` and `host` variables. See other configuration overridable in `config/chexpire.defaults.yml`.
Theses files will be ignored by git.
## Database

View file

@ -32,6 +32,12 @@ module Chexpire
config.time_zone = "Europe/Paris"
config.chexpire = config_for(:chexpire)
unless Rails.root.join("config", "chexpire.yml").readable?
fail "Missing Chexpire configuration file.
You have to create the config/chexpire.yml file and set at least the required values.
Look at config/chexpire.defaults.yml and INSTALL.md for more information"
end
config.chexpire = Hashie::Mash.new(config_for(:"chexpire.defaults").deep_merge(config_for(:chexpire)))
end
end

View file

@ -0,0 +1,53 @@
# DO NOT EDIT THIS FILE
#
# If you want override a value for any environment,
# create a `config/chexpire.yml` file,
# write your overrided keys under your environment namespace.
#
# Some keys are required to be overidden for your environment.
#
# Example:
#
# production:
# mailer_default_from: "contact@yourdomain.org"
# host: mychexpire.instance.org
default: &default
mailer_default_from: "from@example.org" # REQUIRED: Email will be sent with this address as From header
host: chexpire.local # REQUIRED: Host of the website.
interface:
consecutive_failures_as_error: 2 # number of consecutive failures before display a check as "in error" (value for interface only)
notifier:
interval: 0.00 # pause in second between each notification sent
consecutive_failures: 4 # number of consecutive failures before sending a notification for recurrent failures
checks_domain:
interval: 0.5 # pause in second between each whois call
long_term_interval: 300 # when last known expiry date exceeds this interval in days, whois verification won't happen every day
long_term_frequency: 4 # when last known expiry exceeds $long_term, perform whois verification each $long_term_frequency days instead of every day
checks_ssl:
check_http_path: # defaults to check_http in $PATH
check_http_args: # array of arguments appended to defaults arguments (-C 0 -H $HOSTNAME).
development:
<<: *default
host: "chexpire.local"
production:
<<: *default
action_mailer_config:
delivery_method: :sendmail
staging:
<<: *default
action_mailer_config:
delivery_method: :sendmail
test:
<<: *default
mailer_default_from: "testcontact@example.org"
host: localhost
checks_dummy:
interval: 0.0
long_term_interval: 60
long_term_frequency: 10

View file

@ -1,27 +0,0 @@
default: &default
mailer_default_from: "from@example.org"
notifier:
interval: 0.00
failure_days: 3
checks_domain:
interval: 0.5
long_term: 60
long_term_frequency: 10
checks_ssl:
check_http_path: # default to check_http in $PATH)
check_http_args: # array of arguments appended to defaults: -C 0 -H $HOSTNAME.
development:
<<: *default
host: "chexpire.local"
production:
action_mailer_config:
delivery_method: :sendmail
staging:
action_mailer_config:
delivery_method: :sendmail
# test configuration included in file used by CI services
<%= IO.read Rails.root.join("config", "chexpire.test.yml") %>

View file

@ -1,13 +0,0 @@
test:
mailer_default_from: "contact@chexpire.org"
host: "localhost"
notifier:
interval: 0.00
failure_days: 3
checks_domain:
interval: 0.00
long_term: 60
long_term_frequency: 10
checks_ssl:
check_http_path:
check_http_args: