From 755c6d990c79eb743f8f5dc1eb7e50c3c56ff01b Mon Sep 17 00:00:00 2001 From: 7u83 <7u83@mail.ru> Date: Fri, 4 Sep 2020 11:45:37 +0200 Subject: [PATCH] Parameter manage_config added to manage config --- data/common.yaml | 1 + manifests/init.pp | 8 +++++ templates/config.php.erb | 68 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+) create mode 100644 templates/config.php.erb diff --git a/data/common.yaml b/data/common.yaml index c7a580a..7abdb9e 100644 --- a/data/common.yaml +++ b/data/common.yaml @@ -6,6 +6,7 @@ limesurvey::install_path: '/opt/limesurvey' limesurvey::manage_database: true limesurvey::manage_webserver: true limesurvey::manage_php: true +limesurvey::manage_config: false limesurvey::mpm_module: 'prefork' limesurvey::runtime_dir_mode: '0766' limesurvey::vhost_name: 'limesurvey' diff --git a/manifests/init.pp b/manifests/init.pp index 3377439..8dbe367 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -72,6 +72,7 @@ class limesurvey ( Boolean $manage_database, Boolean $manage_webserver, Boolean $manage_php, + Boolean $manage_config, Optional[String] $dbuser = undef, Optional[String] $sql_root_password = undef, @@ -105,4 +106,11 @@ class limesurvey ( contain $php_class } + if $manage_config { + file {"/opt/limesurvey/application/config/config.php": + ensure => file, + content => template("limesurvey/config.php.erb"), + } + } + } diff --git a/templates/config.php.erb b/templates/config.php.erb new file mode 100644 index 0000000..1907e92 --- /dev/null +++ b/templates/config.php.erb @@ -0,0 +1,68 @@ + array( + 'db' => array( + 'connectionString' => 'mysql:host=<%= @dbhost %>;port=3306;dbname=<%= @dbname %>;', + 'emulatePrepare' => true, + 'username' => '<%= @dbuser %>', + 'password' => '<%= @dbpassword %>', + 'charset' => 'utf8mb4', + 'tablePrefix' => 'lime_', + ), + + 'session' => array ( + 'sessionName'=>'LS-MRHASTXFBAQZMYWI' + // Uncomment the following lines if you need table-based sessions. + // Note: Table-based sessions are currently not supported on MSSQL server. + // 'class' => 'application.core.web.DbHttpSession', + // 'connectionID' => 'db', + // 'sessionTableName' => '{{sessions}}', + ), + + 'urlManager' => array( + 'urlFormat' => 'path', + 'rules' => array( + // You can add your own rules here + ), + 'showScriptName' => true, + ), + + ), + // For security issue : it's better to set runtimePath out of web access + // Directory must be readable and writable by the webuser + // 'runtimePath'=>'/var/limesurvey/runtime/' + // Use the following config variable to set modified optional settings copied from config-defaults.php + 'config'=>array( + // debug: Set this to 1 if you are looking for errors. If you still get no errors after enabling this + // then please check your error-logs - either in your hosting provider admin panel or in some /logs directory + // on your webspace. + // LimeSurvey developers: Set this to 2 to additionally display STRICT PHP error messages and get full access to standard templates + 'debug'=>0, + 'debugsql'=>0, // Set this to 1 to enanble sql logging, only active when debug = 2 + // Update default LimeSurvey config here + ) +); +/* End of file config.php */ +/* Location: ./application/config/config.php */