Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • Comptoir/puppet-comptoir-du-libre
1 result
Show changes
Commits on Source (8)
......@@ -38,6 +38,9 @@ The following parameters are available in the `comptoir` class:
* [`app_default_uri`](#-comptoir--app_default_uri)
* [`app_name`](#-comptoir--app_name)
* [`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)
......@@ -110,6 +113,30 @@ A custom string displayed to users as short name of service.
Default value: `'Comptoir'`
##### <a name="-comptoir--app_session_lifetime"></a>`app_session_lifetime`
Data type: `Integer`
Lifetime of webapp session in seconds
Default value: `3600`
##### <a name="-comptoir--app_user_min_password_lenght"></a>`app_user_min_password_lenght`
Data type: `Integer`
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]`
......
......@@ -8,6 +8,9 @@
# @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_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.
......@@ -49,6 +52,9 @@ class comptoir (
Stdlib::HTTPUrl $app_default_uri = 'https://comptoir.example.org/',
String[1] $app_name = 'Comptoir-du-Libre',
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',
......
......@@ -30,8 +30,14 @@ describe 'comptoir' do
.with_content(sensitive(%r{^WEBAPP_SHORTNAME='Comptoir'$}))
is_expected.to contain_file('/etc/comptoir/env.prod.local') \
.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') \
.with_content(sensitive(%r{^WEBAPP_USER_CONFIG_MIN_PASSWORD_LENGTH=12$}))
end
end
......@@ -55,7 +61,7 @@ describe 'comptoir' do
end
end
context '/etc/comptoir/env.prod.local with custom app_secret' do
context '/etc/comptoir/env.prod.local with custom app_secret' do
let(:params) do
{
app_secret: 'ThisCustomTokenIsNotSoSecret',
......@@ -155,6 +161,58 @@ describe 'comptoir' do
end
end
context '/etc/comptoir/env.prod.local with custom session lifetime (smaller than default value: 60 seconds)' do
let(:params) do
{
app_session_lifetime: 60,
}
end
it do
is_expected.to contain_file('/etc/comptoir/env.prod.local') \
.with_content(sensitive(%r{^WEBAPP_SESSION_LIFETIME=60$}))
end
end
context '/etc/comptoir/env.prod.local with custom session lifetime (greater than default value: 30 days)' do
let(:params) do
{
app_session_lifetime: 60 * 60 * 24 * 30, # 60 seconds * 60 minutes * 24 hours * 30 days = 2 592 000 seconds
}
end
it do
is_expected.to contain_file('/etc/comptoir/env.prod.local') \
.with_content(sensitive(%r{^WEBAPP_SESSION_LIFETIME=2592000$}))
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
{
......@@ -168,7 +226,7 @@ describe 'comptoir' do
end
end
context '/etc/comptoir/env.prod.local with trusted_hosts' do
context '/etc/comptoir/env.prod.local with custom trusted_hosts' do
let(:params) do
{
trusted_hosts: '^example.org$',
......@@ -180,6 +238,32 @@ describe 'comptoir' do
.with_content(sensitive(%r{^WEBAPP_TRUSTED_HOSTS='\^example\.org\$'$}))
end
end
context '/etc/comptoir/env.prod.local with custom min password length (smaller than default value: 8 characters)' do
let(:params) do
{
app_user_min_password_lenght: 8,
}
end
it do
is_expected.to contain_file('/etc/comptoir/env.prod.local') \
.with_content(sensitive(%r{^WEBAPP_USER_CONFIG_MIN_PASSWORD_LENGTH=8$}))
end
end
context '/etc/comptoir/env.prod.local with custom min password length (greater than default value: 16 characters)' do
let(:params) do
{
app_user_min_password_lenght: 16,
}
end
it do
is_expected.to contain_file('/etc/comptoir/env.prod.local') \
.with_content(sensitive(%r{^WEBAPP_USER_CONFIG_MIN_PASSWORD_LENGTH=16$}))
end
end
end
end
end
......@@ -39,12 +39,12 @@ WEBAPP_EMAIL_ALERTING_TO='<%= $comptoir::smtp_mailalertingto %>'
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_SESSION_LIFETIME=3600
# WEBAPP_USER_CONFIG_PASSWORD_RESET_TOKEN_LIFETIME=1200
# WEBAPP_USER_CONFIG_MIN_PASSWORD_LENGTH=12
# WEBAPP_SOFTWARE_VERSION_DISPLAYED_PUBLICLY=true
#######################################################################################################################