From 2c0bde6219659a2d7fca213af635db3a69b74d66 Mon Sep 17 00:00:00 2001 From: Ari Timonen Date: Sat, 11 Apr 2020 16:17:07 +0300 Subject: [PATCH] Updat .env docs --- .env | 22 +++++++++++++++++----- .env.test | 1 - config/application.rb | 5 +++++ config/secrets.yml | 8 ++++---- 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/.env b/.env index e0004e5..c309213 100644 --- a/.env +++ b/.env @@ -21,8 +21,9 @@ STAGING_DOMAIN=www.ensl.org STAGING_ROOT_DOMAIN=ensl.org # FIXME: SCRYPT_SALT_OPTS doesn't work yet -# Options for: SCrypt::Engine.calibrate!(max_mem: 16 * 1024 * 1024) SCRYPT_SALT_OPTS= + +# Options for: SCrypt::Engine.calibrate!(max_mem: 16 * 1024 * 1024) SCRYPT_MAX_TIME=0.01 # SMTP server @@ -31,7 +32,18 @@ MAIL_DOMAIN=ensl.org # App path inside docker APP_PATH=/var/www APP_PATH_PUBLIC=/var/www/public + +# Path to files. When Directory.recreate() is called it uses this as root. +FILES_PATH=/var/www/public/files + +# Path to bundle directory +# Gems are added here to avoid reinstalling them all the time. +BUNDLE_PATH=/var/bundle + +# This is a temp directory for assets before they are copied back ASSETS_PATH=/home/web/assets + +# Set 1 to precompile assets ASSETS_PRECOMPILE=0 # Puma fails in cluster mode, so use 0 workers @@ -40,21 +52,21 @@ PUMA_WORKERS=0 # Threads and port PUMA_MIN_THREADS=1 PUMA_MAX_THREADS=16 + +# Puma port. Only really used internally except for dev. +# This could be the same but because docker-compose exposes it, it has to change between envs. PUMA_PORT=4000 # Use higher timeout if debug fails PUMA_TIMEOUT=30 -# Path to files -FILES_PATH=/var/www/public/files - # Docker adds mysql to hosts MYSQL_HOST=db # This is used by both rails + mysql MYSQL_DATABASE=ensl -# These are for ENSL, edit at least password +# MariaDB creates user with these details. MYSQL_USER=ensl MYSQL_PASSWORD=ensl diff --git a/.env.test b/.env.test index a467c03..f616892 100644 --- a/.env.test +++ b/.env.test @@ -4,7 +4,6 @@ RACK_ENV=test RAILS_ENV=test APP_SECRET=fe837ea72667ec3d8ecb94cfba1a1bba - APP_PATH=/var/www PUMA_PORT=4000 diff --git a/config/application.rb b/config/application.rb index 3c5c363..1a1e7fc 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,4 +1,9 @@ require_relative 'boot' +require 'securerandom' + +# FIXME +# Set random value for this +ENV["APP_SECRET_KEY_BASE"] ||= SecureRandom.alphanumeric(32) require 'rails/all' diff --git a/config/secrets.yml b/config/secrets.yml index 6da0179..c44a38b 100644 --- a/config/secrets.yml +++ b/config/secrets.yml @@ -1,11 +1,11 @@ development: - secret_key_base: <%= ENV["APP_SECRET_KEY_BASE"] || SecureRandom.alphanumeric(32) %> + secret_key_base: <%= ENV["APP_SECRET_KEY_BASE"] %> test: - secret_key_base: <%= ENV["APP_SECRET_KEY_BASE"] || SecureRandom.alphanumeric(32) %> + secret_key_base: <%= ENV["APP_SECRET_KEY_BASE"] %> production: - secret_key_base: <%= ENV["APP_SECRET_KEY_BASE"] || SecureRandom.alphanumeric(32) %> + secret_key_base: <%= ENV["APP_SECRET_KEY_BASE"] %> staging: - secret_key_base: <%= ENV["APP_SECRET_KEY_BASE"] || SecureRandom.alphanumeric(32) %> \ No newline at end of file + secret_key_base: <%= ENV["APP_SECRET_KEY_BASE"] %> \ No newline at end of file