Files
nairobi/config/secrets.yml.example
Javi Martín 06d0c26126 Allow having different SMTP settings per tenant
Right now this is configured using the `secrets.yml` file, which is the
file we've used in the past to configure SMTP settings.

Note that, in the `current_secrets` method, the `if default?` condition
is there so in single-tenant applications it returns the exact same
object as `Rails.application.secrets`, and it makes it immediately clear
for developers reading the code. We're also caching the tenant secrets
(using `||=`) so they behave the same way as Rails secrets; for this to
work properly 100% of the time (for example, in tests) we need to expire
these cached secrets whenever the Rails secrets change.

A similar `unless Tenant.default?` condition is present in the
ApplicationMailer because there's a chance some CONSUL installations
might not be using secrets to define the SMTP settings(they might be
using environment variables, for example) and so in this case we don't
want to force settings based on the secrets.yml file because it would
break the application.

The structure of the SMTP settings in the secrets file should be:

```
production:
  tenants:
    name_of_the_tenant_subdomain:
      smtp_settings:
        address:
        (...)
```
2022-11-11 01:39:29 +01:00

147 lines
3.7 KiB
Plaintext

maps: &maps
map_tiles_provider: "//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
map_tiles_provider_attribution: "&copy; <a href=\"http://osm.org/copyright\">OpenStreetMap</a> contributors"
apis: &apis
microsoft_api_key: ""
census_api_end_point: ""
census_api_institution_code: ""
census_api_portal_name: ""
census_api_user_code: ""
sms_end_point: ""
sms_username: ""
sms_password: ""
http_basic_auth: &http_basic_auth
http_basic_auth: true
development:
http_basic_username: "dev"
http_basic_password: "pass"
multitenancy: false
secret_key_base: 56792feef405a59b18ea7db57b4777e855103882b926413d4afdfb8c0ea8aa86ea6649da4e729c5f5ae324c0ab9338f789174cf48c544173bc18fdc3b14262e4
<<: *maps
test:
secret_key_base: 56792feef405a59b18ea7db57b4777e855103882b926413d4afdfb8c0ea8aa86ea6649da4e729c5f5ae324c0ab9338f789174cf48c544173bc18fdc3b14262e4
<<: *maps
staging:
# secret_key_base: ""
server_name: ""
# mailer_delivery_method: :smtp
# smtp_settings:
# :address: "smtp.example.com"
# :port: 25
# :domain: "your_domain.com"
# :user_name: "<username>"
# :password: "<password>"
# :authentication: "plain"
# :enable_starttls_auto: true
force_ssl: true
delay_jobs: true
email_interceptor_recipients: ""
errbit_host: ""
errbit_project_key: ""
errbit_project_id: 1
errbit_self_hosted_ssl: false
http_basic_username: ""
http_basic_password: ""
managers_url: ""
managers_application_key: ""
multitenancy: false
tenants:
# If you've enabled multitenancy, you can overwrite secrets for a
# specific tenant with:
#
# my_tenant_subdomain:
# secret_key: my_secret_value
#
# Currently you can overwrite SMTP settings.
<<: *maps
<<: *apis
preproduction:
# secret_key_base: ""
server_name: ""
# mailer_delivery_method: :smtp
# smtp_settings:
# :address: "smtp.example.com"
# :port: 25
# :domain: "your_domain.com"
# :user_name: "<username>"
# :password: "<password>"
# :authentication: "plain"
# :enable_starttls_auto: true
force_ssl: true
delay_jobs: true
email_interceptor_recipients: ""
errbit_host: ""
errbit_project_key: ""
errbit_project_id: 1
errbit_self_hosted_ssl: false
http_basic_username: ""
http_basic_password: ""
managers_url: ""
managers_application_key: ""
multitenancy: false
tenants:
# If you've enabled multitenancy, you can overwrite secrets for a
# specific tenant with:
#
# my_tenant_subdomain:
# secret_key: my_secret_value
#
# Currently you can overwrite SMTP settings.
twitter_key: ""
twitter_secret: ""
facebook_key: ""
facebook_secret: ""
google_oauth2_key: ""
google_oauth2_secret: ""
<<: *maps
<<: *apis
production:
# secret_key_base: ""
server_name: ""
# mailer_delivery_method: :smtp
# smtp_settings:
# :address: "smtp.example.com"
# :port: 25
# :domain: "your_domain.com"
# :user_name: "<username>"
# :password: "<password>"
# :authentication: "plain"
# :enable_starttls_auto: true
force_ssl: true
delay_jobs: true
errbit_host: ""
errbit_project_key: ""
errbit_project_id: 1
errbit_self_hosted_ssl: false
http_basic_username: ""
http_basic_password: ""
managers_url: ""
managers_application_key: ""
multitenancy: false
tenants:
# If you've enabled multitenancy, you can overwrite secrets for a
# specific tenant with:
#
# my_tenant_subdomain:
# secret_key: my_secret_value
#
# Currently you can overwrite SMTP settings.
twitter_key: ""
twitter_secret: ""
facebook_key: ""
facebook_secret: ""
google_oauth2_key: ""
google_oauth2_secret: ""
wordpress_oauth2_key: ""
wordpress_oauth2_secret: ""
wordpress_oauth2_site: ""
<<: *maps
<<: *apis