|
|
#!/bin/bash
## Init is run on host ## For now it is run every time the script is launched, but ## it should be launched only once after build.
## Accessible variables are: ## - SERVICE_NAME Name of current service ## - DOCKER_BASE_IMAGE Base image from which this service might be built if any ## - SERVICE_DATASTORE Location on host of the DATASTORE of this service ## - SERVICE_CONFIGSTORE Location on host of the CONFIGSTORE of this service
. lib/common
set -e
if ! [ -e "$FRAMADATE_CODE" ]; then git clone --depth 1 -b v1.2.0-alpha.1 \ https://framagit.org/framasoft/framadate/framadate.git \ "$FRAMADATE_CODE" mv "$FRAMADATE_CODE"/{htaccess.txt,.htaccess} ( cd "$FRAMADATE_CODE" patch -p1 ) < <(cat patch/*.patch)
fi
if ! [ -e "$FRAMADATE_CODE/vendor" ]; then dcomposer global require "hirak/prestissimo:^0.3" \ --prefer-dist \ --no-progress \ --no-suggest \ --classmap-authoritative \ --ignore-platform-reqs fi
cfg_dir=$(cfg_dir_init) || exit 1 cd "$cfg_dir" || exit 1
FRAMADATE_OPTS=( title:NOMAPPLICATION admin-mail:ADRESSEMAILADMIN auto-response-mail:ADRESSEMAILREPONSEAUTO default-language:DEFAULT_LANGUAGE )
cat <<EOF > config.php <?php
EOF
for opt in "${FRAMADATE_OPTS[@]}"; do yaml_opt=${opt%%:*} php_opt=${opt##*:} value=$(options-get "$yaml_opt") || exit 1 echo "const $php_opt = '$value';" >> config.php || exit 1 done
cat <<'EOF' >> config.php
// List of supported languages, fake constant as arrays can be used as constants only in PHP >=5.6 $ALLOWED_LANGUAGES = [ 'fr' => 'Français', 'en' => 'English', 'oc' => 'Occitan', 'es' => 'Español', 'de' => 'Deutsch', 'nl' => 'Dutch', 'it' => 'Italiano', 'br' => 'Brezhoneg', ];
// Path to image file with the title const IMAGE_TITRE = 'images/logo-framadate.png';
// Clean URLs, boolean const URL_PROPRE = true;
// Use REMOTE_USER data provided by web server const USE_REMOTE_USER = true;
// Path to the log file const LOG_FILE = 'log/stdout.log';
// Days (after expiration date) before purging a poll const PURGE_DELAY = 60;
// Max slots per poll const MAX_SLOTS_PER_POLL = 366;
// Number of seconds before we allow to resend an "Remember Edit Link" email. const TIME_EDIT_LINK_EMAIL = 60;
// Config $config = [ /* general config */ 'use_smtp' => true, // use email for polls creation/modification/responses notification 'smtp_options' => [ 'host' => 'localhost', // SMTP server (you could add many servers (main and backup for example) : use ";" like separator 'auth' => false, // Enable SMTP authentication 'username' => '', // SMTP username 'password' => '', // SMTP password 'secure' => '', // Enable encryption (false, tls or ssl) 'port' => 25, // TCP port to connect to ], /* home */ 'show_what_is_that' => true, // display "how to use" section 'show_the_software' => true, // display technical information about the software 'show_cultivate_your_garden' => true, // display "development and administration" information /* create_classic_poll.php / create_date_poll.php */ 'default_poll_duration' => 180, // default values for the new poll duration (number of days). /* create_classic_poll.php */ 'user_can_add_img_or_link' => true, // user can add link or URL when creating his poll. 'markdown_editor_by_default' => true, // The markdown editor for the description is enabled by default 'provide_fork_awesome' => true, // Whether the build-in fork-awesome should be provided ];
EOF
|