2
0

CreateDefaultEnvFiles.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/bin/bash
  2. create-backend-env-file() {
  3. FILE=./docker/.env
  4. cat > $FILE <<- EOM
  5. SERVER_URL=http://localhost:8081
  6. SERVER_PORT=8080 # Be sure that doesn't colision with the frontend port
  7. SQL_LITE=true
  8. SQL_LITE_PATH=./porter.db
  9. # Disable redis by default on non docker environment, if you want to setup redis you can complete the variables commented down below
  10. REDIS_ENABLED=false
  11. # REDIS_HOST=redis
  12. # REDIS_PORT=6379
  13. # REDIS_USER=foo
  14. # REDIS_PASS=bar
  15. # REDIS_DB=0
  16. # If you don't wanna use SQL lite you should fill this data with the postgres connection details
  17. # DB_HOST=localhost
  18. # DB_PORT=5400
  19. # DB_USER=porter
  20. # DB_PASS=porter
  21. # DB_NAME=porter
  22. EOM
  23. }
  24. create-frontend-env-file() {
  25. FILE=./dashboard/.env
  26. cat > $FILE <<- EOM
  27. NODE_ENV=development
  28. # Tell the webpack dev server in wich port we wanna run, it defaults to 8080 but we have to be carefull this is not the same port as the backend
  29. DEV_SERVER_PORT=8081
  30. # Usually we would use nginx, but for this environment we're going to enable webpack-dev-server proxy
  31. ENABLE_PROXY=true
  32. # API server url, this url will be used for the proxy to redirect all /api calls
  33. API_SERVER=http://localhost:8080
  34. EOM
  35. }
  36. if [[ ! -e ./dashboard/.env ]]
  37. then
  38. echo "Dashboard env file (./dashboard/.env) not found, creating one with defaults"
  39. create-frontend-env-file
  40. fi
  41. if [[ ! -e ./docker/.env ]]
  42. then
  43. echo "Server env file (./docker/.env) not found, creating one with defaults"
  44. create-backend-env-file
  45. fi