Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

bootstrap.sh 1.9 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/bash
  2. script_dir="$( dirname "${0}" )"
  3. # Force users to login before seeing any pins.
  4. if [ "${ALLOW_NEW_REGISTRATIONS}" = "" ]; then
  5. ALLOW_NEW_REGISTRATIONS=true
  6. fi
  7. if [[ "$(docker images -q pinry/pinry 2> /dev/null)" == "" ]]; then
  8. echo "No docker image found, building..." && "${script_dir}/build_docker.sh"
  9. fi
  10. echo "=================================================================================="
  11. echo "Note: Please copy this key and keep it in a secure place."
  12. echo "Then you should manually edit your pinry/local_settings.py"
  13. echo "and replace SECRET_KEY with new secret-key if you had previously generated a"
  14. echo "pinry/local_settings.py."
  15. echo "If no previous pinry/local_settings.py generated, you can have a look and edit it."
  16. echo "If you want to use docker-compose, just edit docker-compose.yml and use 'docker-compose up'"
  17. SECRET_KEY=$(sudo docker run pinry/pinry /scripts/gen_key.sh)
  18. echo ""
  19. echo "Your secret-key is(also saved/overwritten your pinry/production_secret_key.txt):"
  20. echo ""
  21. echo ${SECRET_KEY}
  22. echo "=================================================================================="
  23. local_settings_file="${script_dir}/pinry/local_settings.py"
  24. # Create local_settings.py
  25. if [ ! -f "${local_settings_file}" ];
  26. then
  27. cp "${script_dir}/pinry/local_settings.example.py" "${local_settings_file}"
  28. sed -i "s/secret\_key\_place\_holder/${SECRET_KEY}/" "${local_settings_file}"
  29. # Force users to login before seeing any pins.
  30. if [ "${PRIVATE}" = "true" ]; then
  31. sed -i "s/PUBLIC = True/PUBLIC = False/" "${local_settings_file}"
  32. fi
  33. # Enable people from creating new accounts.
  34. if [ "${ALLOW_NEW_REGISTRATIONS}" = "true" ]; then
  35. sed -i "s/ALLOW_NEW_REGISTRATIONS = False/ALLOW_NEW_REGISTRATIONS = True/" "${local_settings_file}"
  36. fi
  37. fi
  38. # Copy to docker-compose.yml
  39. if [ ! -f "${script_dir}/docker-compose.yml" ];
  40. then
  41. cp "${script_dir}/docker-compose.example.yml" "${script_dir}/docker-compose.yml"
  42. fi