You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123 lines
3.8 KiB

  1. #!/bin/bash
  2. ## Init is run on host
  3. ## For now it is run every time the script is launched, but
  4. ## it should be launched only once after build.
  5. ## Accessible variables are:
  6. ## - SERVICE_NAME Name of current service
  7. ## - DOCKER_BASE_IMAGE Base image from which this service might be built if any
  8. ## - SERVICE_DATASTORE Location on host of the DATASTORE of this service
  9. ## - SERVICE_CONFIGSTORE Location on host of the CONFIGSTORE of this service
  10. . lib/common
  11. set -e
  12. if ! [ -e "$FRAMADATE_CODE" ]; then
  13. git clone --depth 1 -b v1.2.0-alpha.1 \
  14. https://framagit.org/framasoft/framadate/framadate.git \
  15. "$FRAMADATE_CODE"
  16. mv "$FRAMADATE_CODE"/{htaccess.txt,.htaccess}
  17. (
  18. cd "$FRAMADATE_CODE"
  19. patch -p1
  20. ) < <(cat patch/*.patch)
  21. fi
  22. if ! [ -e "$FRAMADATE_CODE/vendor" ]; then
  23. dcomposer global require "hirak/prestissimo:^0.3" \
  24. --prefer-dist \
  25. --no-progress \
  26. --no-suggest \
  27. --classmap-authoritative \
  28. --ignore-platform-reqs
  29. fi
  30. cfg_dir=$(cfg_dir_init) || exit 1
  31. cd "$cfg_dir" || exit 1
  32. FRAMADATE_OPTS=(
  33. title:NOMAPPLICATION
  34. admin-mail:ADRESSEMAILADMIN
  35. auto-response-mail:ADRESSEMAILREPONSEAUTO
  36. default-language:DEFAULT_LANGUAGE
  37. )
  38. cat <<EOF > config.php
  39. <?php
  40. EOF
  41. for opt in "${FRAMADATE_OPTS[@]}"; do
  42. yaml_opt=${opt%%:*}
  43. php_opt=${opt##*:}
  44. value=$(options-get "$yaml_opt") || exit 1
  45. echo "const $php_opt = '$value';" >> config.php || exit 1
  46. done
  47. cat <<'EOF' >> config.php
  48. // List of supported languages, fake constant as arrays can be used as constants only in PHP >=5.6
  49. $ALLOWED_LANGUAGES = [
  50. 'fr' => 'Français',
  51. 'en' => 'English',
  52. 'oc' => 'Occitan',
  53. 'es' => 'Español',
  54. 'de' => 'Deutsch',
  55. 'nl' => 'Dutch',
  56. 'it' => 'Italiano',
  57. 'br' => 'Brezhoneg',
  58. ];
  59. // Path to image file with the title
  60. const IMAGE_TITRE = 'images/logo-framadate.png';
  61. // Clean URLs, boolean
  62. const URL_PROPRE = true;
  63. // Use REMOTE_USER data provided by web server
  64. const USE_REMOTE_USER = true;
  65. // Path to the log file
  66. const LOG_FILE = 'log/stdout.log';
  67. // Days (after expiration date) before purging a poll
  68. const PURGE_DELAY = 60;
  69. // Max slots per poll
  70. const MAX_SLOTS_PER_POLL = 366;
  71. // Number of seconds before we allow to resend an "Remember Edit Link" email.
  72. const TIME_EDIT_LINK_EMAIL = 60;
  73. // Config
  74. $config = [
  75. /* general config */
  76. 'use_smtp' => true, // use email for polls creation/modification/responses notification
  77. 'smtp_options' => [
  78. 'host' => 'localhost', // SMTP server (you could add many servers (main and backup for example) : use ";" like separator
  79. 'auth' => false, // Enable SMTP authentication
  80. 'username' => '', // SMTP username
  81. 'password' => '', // SMTP password
  82. 'secure' => '', // Enable encryption (false, tls or ssl)
  83. 'port' => 25, // TCP port to connect to
  84. ],
  85. /* home */
  86. 'show_what_is_that' => true, // display "how to use" section
  87. 'show_the_software' => true, // display technical information about the software
  88. 'show_cultivate_your_garden' => true, // display "development and administration" information
  89. /* create_classic_poll.php / create_date_poll.php */
  90. 'default_poll_duration' => 180, // default values for the new poll duration (number of days).
  91. /* create_classic_poll.php */
  92. 'user_can_add_img_or_link' => true, // user can add link or URL when creating his poll.
  93. 'markdown_editor_by_default' => true, // The markdown editor for the description is enabled by default
  94. 'provide_fork_awesome' => true, // Whether the build-in fork-awesome should be provided
  95. ];
  96. EOF