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.

27 lines
767 B

3 years ago
  1. #!/bin/sh
  2. # Creating customize folder
  3. mkdir -p customize
  4. # Copying default config
  5. mkdir -p cfg
  6. [ ! -f cfg/config.js ] && echo "Creating config.js" && cp config/config.example.js cfg/config.js
  7. # Linking config.js
  8. [ ! -L config/config.js ] && echo "Linking config.js" && ln -s ../cfg/config.js config/config.js
  9. # Thanks to http://stackoverflow.com/a/10467453
  10. sedeasy() {
  11. sed -i "s/$1/$(echo $2 | sed -e 's/[\/&]/\\&/g')/g" $3
  12. }
  13. # Configure
  14. [ -n "$STORAGE" ] && echo "Using storage adapter: $STORAGE" \
  15. && sedeasy "storage: [^,]*," "storage: ${STORAGE}," cfg/config.js
  16. [ -n "$LOG_TO_STDOUT" ] && echo "Logging to stdout: $LOG_TO_STDOUT" \
  17. && sedeasy "logToStdout: [^,]*," "logToStdout: ${LOG_TO_STDOUT}," cfg/config.js
  18. export FRESH=1
  19. exec node ./server.js