Skip to content
Snippets Groups Projects
Commit 5217f9bf authored by Fabrice Gangler's avatar Fabrice Gangler :art:
Browse files

feat: allow to configure WEBAPP_DEFAULT_URI environment variable

parent 6e611598
No related branches found
No related tags found
1 merge request!4Resolve "Allow to configure WEBAPP_DEFAULT_URI environment variable"
Pipeline #76819 canceled
...@@ -35,6 +35,7 @@ The following parameters are available in the `comptoir` class: ...@@ -35,6 +35,7 @@ The following parameters are available in the `comptoir` class:
* [`download_url`](#-comptoir--download_url) * [`download_url`](#-comptoir--download_url)
* [`download_checksum`](#-comptoir--download_checksum) * [`download_checksum`](#-comptoir--download_checksum)
* [`checksum_type`](#-comptoir--checksum_type) * [`checksum_type`](#-comptoir--checksum_type)
* [`app_default_uri`](#-comptoir--app_default_uri)
* [`app_name`](#-comptoir--app_name) * [`app_name`](#-comptoir--app_name)
* [`app_shortname`](#-comptoir--app_shortname) * [`app_shortname`](#-comptoir--app_shortname)
* [`app_secret`](#-comptoir--app_secret) * [`app_secret`](#-comptoir--app_secret)
...@@ -85,6 +86,14 @@ Checksum type given with download_checksum. ...@@ -85,6 +86,14 @@ Checksum type given with download_checksum.
Default value: `'sha256'` Default value: `'sha256'`
##### <a name="-comptoir--app_default_uri"></a>`app_default_uri`
Data type: `Stdlib::HTTPUrl`
Default URI used to generate URLs in a non-HTTP context
Default value: `'https://comptoir.example.org/'`
##### <a name="-comptoir--app_name"></a>`app_name` ##### <a name="-comptoir--app_name"></a>`app_name`
Data type: `String[1]` Data type: `String[1]`
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
# @param download_url URL where Comptoir-du-Libre archive is stored. # @param download_url URL where Comptoir-du-Libre archive is stored.
# @param download_checksum Archive file checksum (match checksum_type) used to verify of archive file. # @param download_checksum Archive file checksum (match checksum_type) used to verify of archive file.
# @param checksum_type Checksum type given with download_checksum. # @param checksum_type Checksum type given with download_checksum.
# @param app_default_uri Default URI used to generate URLs in a non-HTTP context
# @param app_name A custom string displayed to users as name of service. # @param app_name A custom string displayed to users as name of service.
# @param app_shortname A custom string displayed to users as short name of service. # @param app_shortname A custom string displayed to users as short name of service.
# @param app_secret Application secret is required to generate CSRF tokens # @param app_secret Application secret is required to generate CSRF tokens
...@@ -45,6 +46,7 @@ class comptoir ( ...@@ -45,6 +46,7 @@ class comptoir (
String[1] $download_checksum = 'f33363b96fc330b9298d3477f90ee1aaa09eb06605901b72af3d472c054cf223', # 3.0.0.alpha.4 String[1] $download_checksum = 'f33363b96fc330b9298d3477f90ee1aaa09eb06605901b72af3d472c054cf223', # 3.0.0.alpha.4
Enum['md5', 'sha1', 'sha2', 'sha256', 'sha384', 'sha512'] $checksum_type = 'sha256', Enum['md5', 'sha1', 'sha2', 'sha256', 'sha384', 'sha512'] $checksum_type = 'sha256',
String[1] $app_secret = 'ThisTokenIsNotSoSecretChangeIt', String[1] $app_secret = 'ThisTokenIsNotSoSecretChangeIt',
Stdlib::HTTPUrl $app_default_uri = 'https://comptoir.example.org/',
String[1] $app_name = 'Comptoir-du-Libre', String[1] $app_name = 'Comptoir-du-Libre',
String[1] $app_shortname = 'Comptoir', String[1] $app_shortname = 'Comptoir',
Stdlib::Absolutepath $config_path = '/etc/comptoir', Stdlib::Absolutepath $config_path = '/etc/comptoir',
......
...@@ -22,6 +22,8 @@ describe 'comptoir' do ...@@ -22,6 +22,8 @@ describe 'comptoir' do
is_expected.to contain_file('/etc/comptoir/env.prod.local') \ is_expected.to contain_file('/etc/comptoir/env.prod.local') \
.with_content(sensitive(%r{^MAILER_DSN=smtp://127.0.0.1:25$})) .with_content(sensitive(%r{^MAILER_DSN=smtp://127.0.0.1:25$}))
is_expected.to contain_file('/etc/comptoir/env.prod.local') \
.with_content(sensitive(%r{^WEBAPP_DEFAULT_URI='https://comptoir.example.org/'$}))
is_expected.to contain_file('/etc/comptoir/env.prod.local') \ is_expected.to contain_file('/etc/comptoir/env.prod.local') \
.with_content(sensitive(%r{^WEBAPP_NAME='Comptoir-du-Libre'$})) .with_content(sensitive(%r{^WEBAPP_NAME='Comptoir-du-Libre'$}))
is_expected.to contain_file('/etc/comptoir/env.prod.local') \ is_expected.to contain_file('/etc/comptoir/env.prod.local') \
...@@ -95,6 +97,19 @@ describe 'comptoir' do ...@@ -95,6 +97,19 @@ describe 'comptoir' do
end end
end end
context '/etc/comptoir/env.prod.local with custom WEBAPP_DEFAULT_URI' do
let(:params) do
{
app_default_uri: 'http://new-comptoir.example.org/',
}
end
it do
is_expected.to contain_file('/etc/comptoir/env.prod.local') \
.with_content(sensitive(%r{^WEBAPP_DEFAULT_URI='http://new-comptoir.example.org/'$}))
end
end
context '/etc/comptoir/env.prod.local with custom emails (mail from, mail alerting to)' do context '/etc/comptoir/env.prod.local with custom emails (mail from, mail alerting to)' do
let(:params) do let(:params) do
{ {
......
...@@ -33,6 +33,7 @@ APP_SECRET=<%= $comptoir::app_secret %> ...@@ -33,6 +33,7 @@ APP_SECRET=<%= $comptoir::app_secret %>
DATABASE_URL="postgresql://<%= $comptoir::db_user %>:<%= $comptoir::db_password %>@<%= $comptoir::db_host %>:5432/<%= $comptoir::db_name %>?serverVersion=<%= $comptoir::db_version %>&charset=utf8" DATABASE_URL="postgresql://<%= $comptoir::db_user %>:<%= $comptoir::db_password %>@<%= $comptoir::db_host %>:5432/<%= $comptoir::db_name %>?serverVersion=<%= $comptoir::db_version %>&charset=utf8"
MAILER_DSN=smtp://<% if $comptoir::smtp_user { %><%= $comptoir::smtp_user %>:<%= $comptoir::smtp_password %>@<% } %><%= $comptoir::smtp_host %>:<%= $comptoir::smtp_port %> MAILER_DSN=smtp://<% if $comptoir::smtp_user { %><%= $comptoir::smtp_user %>:<%= $comptoir::smtp_password %>@<% } %><%= $comptoir::smtp_host %>:<%= $comptoir::smtp_port %>
WEBAPP_DEFAULT_URI='<%= $comptoir::app_default_uri %>'
WEBAPP_EMAIL_FROM='<%= $comptoir::smtp_mailfrom %>' WEBAPP_EMAIL_FROM='<%= $comptoir::smtp_mailfrom %>'
WEBAPP_EMAIL_ALERTING_TO='<%= $comptoir::smtp_mailalertingto %>' WEBAPP_EMAIL_ALERTING_TO='<%= $comptoir::smtp_mailalertingto %>'
WEBAPP_NAME='<%= $comptoir::app_name %>' WEBAPP_NAME='<%= $comptoir::app_name %>'
...@@ -42,7 +43,6 @@ WEBAPP_TIMEZONE='<%= $comptoir::timezone %>' ...@@ -42,7 +43,6 @@ WEBAPP_TIMEZONE='<%= $comptoir::timezone %>'
WEBAPP_TRUSTED_HOSTS='<%= $comptoir::trusted_hosts %>' WEBAPP_TRUSTED_HOSTS='<%= $comptoir::trusted_hosts %>'
############ Environment variables not yet managed by Puppet ########################################################## ############ Environment variables not yet managed by Puppet ##########################################################
# WEBAPP_DEFAULT_URI='https://example.org/'
# WEBAPP_SESSION_LIFETIME=3600 # WEBAPP_SESSION_LIFETIME=3600
# WEBAPP_USER_CONFIG_PASSWORD_RESET_TOKEN_LIFETIME=1200 # WEBAPP_USER_CONFIG_PASSWORD_RESET_TOKEN_LIFETIME=1200
# WEBAPP_USER_CONFIG_MIN_PASSWORD_LENGTH=12 # WEBAPP_USER_CONFIG_MIN_PASSWORD_LENGTH=12
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment