Add config.php.tpl
Some checks are pending
Deploy Moodle to STACKIT Cloud Foundry / deploy (push) Waiting to run
Some checks are pending
Deploy Moodle to STACKIT Cloud Foundry / deploy (push) Waiting to run
This commit is contained in:
parent
9f5fc7eebb
commit
9a835eccd1
1 changed files with 82 additions and 0 deletions
82
config.php.tpl
Normal file
82
config.php.tpl
Normal file
|
|
@ -0,0 +1,82 @@
|
||||||
|
<?php // Moodle configuration file - AUTOMATISCH GENERIERT VON TERRAFORM
|
||||||
|
|
||||||
|
unset($CFG);
|
||||||
|
global $CFG;
|
||||||
|
$CFG = new stdClass();
|
||||||
|
|
||||||
|
$CFG->wwwroot = "${wwwroot}";
|
||||||
|
$CFG->dirroot = __DIR__;
|
||||||
|
$CFG->dataroot = '/tmp/moodledata';
|
||||||
|
$CFG->admin = 'admin';
|
||||||
|
$CFG->directorypermissions = 0777;
|
||||||
|
|
||||||
|
$CFG->sslproxy = 1;
|
||||||
|
$CFG->slasharguments = false;
|
||||||
|
%{ if use_cdn ~}
|
||||||
|
$CFG->reverseproxy = 1;
|
||||||
|
$CFG->trustedproxies = '127.0.0.1, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, ${cdn_proxy_ip}';
|
||||||
|
%{ endif ~}
|
||||||
|
|
||||||
|
if (!file_exists($CFG->dataroot)) {
|
||||||
|
@mkdir($CFG->dataroot, $CFG->directorypermissions, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$CFG->dbtype = 'mariadb';
|
||||||
|
$CFG->dblibrary = 'native';
|
||||||
|
$CFG->prefix = 'mdl_';
|
||||||
|
$CFG->dboptions = array ('dbpersist' => 0, 'dbcollation' => 'utf8mb4_unicode_ci');
|
||||||
|
|
||||||
|
$vcap_services_json = getenv('VCAP_SERVICES');
|
||||||
|
if ($vcap_services_json) {
|
||||||
|
$vcap_services = json_decode($vcap_services_json, true);
|
||||||
|
|
||||||
|
if (isset($vcap_services["${db_service_name}"])) {
|
||||||
|
$db_creds = $vcap_services["${db_service_name}"][0]['credentials'];
|
||||||
|
$CFG->dbhost = $db_creds['host'];
|
||||||
|
$CFG->dbname = $db_creds['name'];
|
||||||
|
$CFG->dbuser = $db_creds['username'];
|
||||||
|
$CFG->dbpass = $db_creds['password'];
|
||||||
|
$CFG->dboptions['dbport'] = $db_creds['port'];
|
||||||
|
if (isset($db_creds['cacrt'])) {
|
||||||
|
$ca_cert_path = '/tmp/db-ca.crt';
|
||||||
|
file_put_contents($ca_cert_path, $db_creds['cacrt']);
|
||||||
|
$CFG->dboptions['ssl_ca'] = $ca_cert_path;
|
||||||
|
$CFG->dboptions['ssl_verify_server_cert'] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($vcap_services["${redis_service_name}"])) {
|
||||||
|
$redis_creds = $vcap_services["${redis_service_name}"][0]['credentials'];
|
||||||
|
$CFG->session_handler_class = '\cachestore_redis\session_handler';
|
||||||
|
$CFG->session_redis_host = $redis_creds['host'];
|
||||||
|
$CFG->session_redis_port = $redis_creds['port'];
|
||||||
|
$CFG->session_redis_password = $redis_creds['password'];
|
||||||
|
$CFG->session_redis_prefix = 'moodlesess_';
|
||||||
|
$CFG->lock_factory = '\cachestore_redis\lock_factory';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($vcap_services['user-provided'])) {
|
||||||
|
foreach ($vcap_services['user-provided'] as $service) {
|
||||||
|
if ($service['name'] === '${s3_cups_name}') {
|
||||||
|
$s3_creds = $service['credentials'];
|
||||||
|
$CFG->objectfs_s3_key = $s3_creds['access_key'];
|
||||||
|
$CFG->objectfs_s3_secret = $s3_creds['secret_key'];
|
||||||
|
$CFG->objectfs_s3_bucket = $s3_creds['bucket'];
|
||||||
|
$CFG->objectfs_s3_endpoint = $s3_creds['endpoint'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (empty($CFG->session_handler_class)) {
|
||||||
|
$CFG->session_handler_class = '\core\session\database';
|
||||||
|
}
|
||||||
|
|
||||||
|
%{ if use_cdn ~}
|
||||||
|
$CFG->cookiepath = '/';
|
||||||
|
$CFG->cookiedomain = "${moodle_domain}";
|
||||||
|
$CFG->cookiesecure = 1;
|
||||||
|
$CFG->cookiehttponly = 1;
|
||||||
|
%{ endif ~}
|
||||||
|
|
||||||
|
require_once(__DIR__ . '/lib/setup.php');
|
||||||
Loading…
Reference in a new issue