summaryrefslogtreecommitdiffstats
path: root/docker
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2018-08-19 01:38:49 +0200
committerFlorian Pritz <bluewind@xinu.at>2018-08-19 01:38:49 +0200
commit2a154a6cf5b7bf17f8a992bb9507bba37b0543be (patch)
tree283861a83fa61237de6e233d0cb6b651db622716 /docker
parentaa2242090433be62d3f88ec6b402d1554606c0f2 (diff)
Update docker setup
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'docker')
-rwxr-xr-xdocker/filebin_starter.sh40
1 files changed, 34 insertions, 6 deletions
diff --git a/docker/filebin_starter.sh b/docker/filebin_starter.sh
index 4fa50d583..7f0b70d85 100755
--- a/docker/filebin_starter.sh
+++ b/docker/filebin_starter.sh
@@ -1,15 +1,44 @@
#!/bin/bash
+#set -euo pipefail
+
function set_config() {
FB_ENCRYPTION_KEY=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c32`
- sed -i "s/\$config\['encryption_key'\] = ''/\$config['encryption_key'] = '${FB_ENCRYPTION_KEY}'/" ${FILEBIN_DIR}/application/config/config-local.php
+cat <<EOF >${FILEBIN_DIR}/application/config/config-local.php
+<?php
+\$config['base_url'] = 'http://127.0.0.1:8080/';
+\$config['encryption_key'] = '${FB_ENCRYPTION_KEY}';
+EOF
}
function set_database_config() {
- sed -i "s/\$db\['default'\]\['hostname'\] = .*/\$db['default']['hostname'] = \"${FB_DB_HOSTNAME}\";/" ${FILEBIN_DIR}/application/config/database.php
- sed -i "s/\$db\['default'\]\['username'\] = .*/\$db['default']['username'] = \"${FB_DB_USERNAME}\";/" ${FILEBIN_DIR}/application/config/database.php
- sed -i "s/\$db\['default'\]\['password'\] = .*/\$db['default']['password'] = \"${FB_DB_PASSWORD}\";/" ${FILEBIN_DIR}/application/config/database.php
- sed -i "s/\$db\['default'\]\['database'\] = .*/\$db['default']['database'] = \"${FB_DB_DATABASE}\";/" ${FILEBIN_DIR}/application/config/database.php
+cat <<EOF >${FILEBIN_DIR}/application/config/database.php
+<?php
+defined('BASEPATH') OR exit('No direct script access allowed');
+\$active_group = 'default';
+\$query_builder = TRUE;
+
+\$db['default'] = array(
+ 'dsn' => 'mysql:host=${FB_DB_HOSTNAME};dbname=${FB_DB_DATABASE}',
+ 'hostname' => '',
+ 'port' => 3306,
+ 'username' => '${FB_DB_USERNAME}',
+ 'password' => '${FB_DB_PASSWORD}',
+ 'database' => '',
+ 'dbdriver' => 'pdo',
+ 'dbprefix' => '',
+ 'pconnect' => FALSE,
+ 'db_debug' => TRUE,
+ 'char_set' => 'utf8mb4', // if you use postgres, set this to utf8
+ 'dbcollat' => 'utf8mb4_bin', // if you use postgres, set this to utf8_bin
+ 'swap_pre' => '',
+ 'encrypt' => FALSE,
+ 'compress' => FALSE,
+ 'stricton' => TRUE,
+ 'failover' => array(),
+ 'save_queries' => TRUE
+);
+EOF
}
# wait for DB to be ready
@@ -21,7 +50,6 @@ done
if [[ ! -e $FILEBIN_DIR/application/config/config-local.php ]]; then
echo "no config found, new config will be generated"
- cp $FILEBIN_DIR/application/config/example/config-local.php ${FILEBIN_DIR}/application/config/config-local.php
set_config
set_database_config