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

feat: allow to configure WEBAPP_SOFTWARE_VERSION_DISPLAYED_PUBLICLY environment variable

parent 133169a3
No related branches found
No related tags found
1 merge request!7Resolve "Allow to configure WEBAPP_SOFTWARE_VERSION_DISPLAYED_PUBLICLY environment variable"
Pipeline #76899 passed
......@@ -40,6 +40,7 @@ The following parameters are available in the `comptoir` class:
* [`app_shortname`](#-comptoir--app_shortname)
* [`app_session_lifetime`](#-comptoir--app_session_lifetime)
* [`app_user_min_password_lenght`](#-comptoir--app_user_min_password_lenght)
* [`app_version_displayed_publicly`](#-comptoir--app_version_displayed_publicly)
* [`app_secret`](#-comptoir--app_secret)
* [`config_path`](#-comptoir--config_path)
* [`var_path`](#-comptoir--var_path)
......@@ -128,6 +129,14 @@ Minimum user password length
Default value: `12`
##### <a name="-comptoir--app_version_displayed_publicly"></a>`app_version_displayed_publicly`
Data type: `Boolean`
Public display of software version
Default value: `false`
##### <a name="-comptoir--app_secret"></a>`app_secret`
Data type: `String[1]`
......
......@@ -10,6 +10,7 @@
# @param app_shortname A custom string displayed to users as short name of service.
# @param app_session_lifetime Lifetime of webapp session in seconds
# @param app_user_min_password_lenght Minimum user password length
# @param app_version_displayed_publicly Public display of software version
# @param app_secret Application secret is required to generate CSRF tokens
# @param config_path Directory where Comptoir-du-Libre configuration file is stored.
# @param var_path Directory where Comptoir-du-Libre stores var files.
......@@ -53,6 +54,7 @@ class comptoir (
String[1] $app_shortname = 'Comptoir',
Integer $app_session_lifetime = 3600,
Integer $app_user_min_password_lenght = 12,
Boolean $app_version_displayed_publicly = false,
Stdlib::Absolutepath $config_path = '/etc/comptoir',
Stdlib::Absolutepath $var_path = '/var/comptoir',
String[1] $trusted_hosts = $facts['networking']['fqdn'],
......
......@@ -20,6 +20,7 @@ describe 'comptoir' do
class { 'comptoir':
download_url => '#{download_url_initial}',
download_checksum => '#{download_checksum_initial}',
app_version_displayed_publicly => true,
trusted_hosts => '127.0.0.1',
sys_rootpath => '#{sys_rootpath}',
sys_rootpath_mode => '0700',
......@@ -148,6 +149,7 @@ describe 'comptoir' do
class { 'comptoir':
download_url => '#{download_url_upgrade}',
download_checksum => '#{download_checksum_upgrade}',
app_version_displayed_publicly => true,
trusted_hosts => '127.0.0.1',
sys_rootpath => '#{sys_rootpath}',
sys_rootpath_mode => '0700',
......
......@@ -32,6 +32,8 @@ describe 'comptoir' do
.with_content(sensitive(%r{^WEBAPP_I18N_DEFAULT_LOCALE='en'$}))
is_expected.to contain_file('/etc/comptoir/env.prod.local') \
.with_content(sensitive(%r{^WEBAPP_SESSION_LIFETIME=3600$}))
is_expected.to contain_file('/etc/comptoir/env.prod.local') \
.with_content(sensitive(%r{^WEBAPP_SOFTWARE_VERSION_DISPLAYED_PUBLICLY=false$}))
is_expected.to contain_file('/etc/comptoir/env.prod.local') \
.with_content(sensitive(%r{^WEBAPP_TIMEZONE='Europe/Paris'$}))
is_expected.to contain_file('/etc/comptoir/env.prod.local') \
......@@ -185,6 +187,32 @@ describe 'comptoir' do
end
end
context '/etc/comptoir/env.prod.local with custom webapp version displayed publicly (true)' do
let(:params) do
{
app_version_displayed_publicly: true,
}
end
it do
is_expected.to contain_file('/etc/comptoir/env.prod.local') \
.with_content(sensitive(%r{^WEBAPP_SOFTWARE_VERSION_DISPLAYED_PUBLICLY=true$}))
end
end
context '/etc/comptoir/env.prod.local with custom webapp version displayed publicly (false)' do
let(:params) do
{
app_version_displayed_publicly: false,
}
end
it do
is_expected.to contain_file('/etc/comptoir/env.prod.local') \
.with_content(sensitive(%r{^WEBAPP_SOFTWARE_VERSION_DISPLAYED_PUBLICLY=false$}))
end
end
context '/etc/comptoir/env.prod.local with custom timezone: Pacific/Tahiti' do
let(:params) do
{
......
......@@ -40,11 +40,11 @@ WEBAPP_NAME='<%= $comptoir::app_name %>'
WEBAPP_SHORTNAME='<%= $comptoir::app_shortname %>'
WEBAPP_I18N_DEFAULT_LOCALE='<%= $comptoir::i18ndefaultlocale %>'
WEBAPP_SESSION_LIFETIME=<%= $comptoir::app_session_lifetime %>
WEBAPP_SOFTWARE_VERSION_DISPLAYED_PUBLICLY=<% if $comptoir::app_version_displayed_publicly == true { %>true<% } else { %>false<% } %>
WEBAPP_TIMEZONE='<%= $comptoir::timezone %>'
WEBAPP_TRUSTED_HOSTS='<%= $comptoir::trusted_hosts %>'
WEBAPP_USER_CONFIG_MIN_PASSWORD_LENGTH=<%= $comptoir::app_user_min_password_lenght %>
############ Environment variables not yet managed by Puppet ##########################################################
# WEBAPP_USER_CONFIG_PASSWORD_RESET_TOKEN_LIFETIME=1200
# WEBAPP_SOFTWARE_VERSION_DISPLAYED_PUBLICLY=true
#######################################################################################################################
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