diff --git a/Dockerfile b/Dockerfile index 5c06009..ecb683a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,4 +14,4 @@ ENTRYPOINT ["entrypoint.sh"] EXPOSE 3000 # Start the main process. -CMD ["rails", "server", "-b", "0.0.0.0"] \ No newline at end of file +CMD ["rails", "server", "-b", "0.0.0.0", "-e", "production"] diff --git a/Gemfile b/Gemfile index d9305ea..fb3a475 100644 --- a/Gemfile +++ b/Gemfile @@ -51,3 +51,4 @@ gem 'activeadmin' gem 'devise' gem 'devise-jwt', '~> 0.5.9' gem 'pg', '~> 1.1' +gem 'sassc', '< 2.2.0' diff --git a/Gemfile.lock b/Gemfile.lock index 0b6ed55..471ba39 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -111,8 +111,8 @@ GEM factory_bot_rails (5.1.1) factory_bot (~> 5.1.0) railties (>= 4.2.0) - ffi (1.11.1) - ffi (1.11.1-x64-mingw32) + ffi (1.12.2) + ffi (1.12.2-x64-mingw32) formtastic (3.1.5) actionpack (>= 3.2.13) formtastic_i18n (0.6.0) @@ -248,7 +248,9 @@ GEM unicode-display_width (>= 1.4.0, < 1.7) ruby-progressbar (1.10.1) ruby_dep (1.5.0) - sassc (2.2.1-x64-mingw32) + sassc (2.1.0) + ffi (~> 1.9) + sassc (2.1.0-x64-mingw32) ffi (~> 1.9) sassc-rails (2.1.2) railties (>= 4.0.0) @@ -308,6 +310,7 @@ DEPENDENCIES rails (~> 6.0.0) rspec-rails (~> 3.5) rubocop + sassc (< 2.2.0) spring spring-watcher-listen (~> 2.0.0) tzinfo-data diff --git a/config/application.rb b/config/application.rb index f534037..0d6cae4 100644 --- a/config/application.rb +++ b/config/application.rb @@ -21,7 +21,9 @@ # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) -Dotenv::Railtie.load +unless Rails.env.production? + Dotenv::Railtie.load +end module SdcApi class Application < Rails::Application @@ -38,6 +40,8 @@ class Application < Rails::Application # Skip views, helpers and assets when generating a new resource. config.api_only = true + puts Rails.env + # Middleware for ActiveAdmin config.middleware.use Rack::MethodOverride config.middleware.use ActionDispatch::Flash diff --git a/config/environments/development.rb b/config/environments/development.rb index 5ba51e7..928d464 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,8 +1,7 @@ # frozen_string_literal: true Rails.application.configure do - - config.hosts << "warm-hollows-93227.herokuapp.com" + config.hosts << 'warm-hollows-93227.herokuapp.com' # Settings specified here will take precedence over those in config/application.rb. diff --git a/config/initializers/environment.rb b/config/initializers/environment.rb index 121e042..d1fb5da 100644 --- a/config/initializers/environment.rb +++ b/config/initializers/environment.rb @@ -3,11 +3,13 @@ # ENVIRONMENT VARIABLES # DEVELOPMENT -unless Rails.env.production? +if Rails.env.production? + ENV['SECRET_KEY_BASE'] = 'production-key' +else ENV['DB_PASS_DEV'] = 'sdcdev' ENV['DB_USER_DEV'] = 'postgres' ENV['DB_NAME_DEV'] = 'sdc' - ENV['DB_HOST_DEV'] = 'db' + ENV['DB_HOST_DEV'] = 'localhost' ENV['DB_PORT_DEV'] = '5432' ENV['DB_TIMEOUT_DEV'] = '5000' ENV['DB_ADAPTER_DEV'] = 'postgresql' diff --git a/config/secrets.yml b/config/secrets.yml new file mode 100644 index 0000000..6ab16c0 --- /dev/null +++ b/config/secrets.yml @@ -0,0 +1,3 @@ +# config/secrets.yml +production: + secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index fcad1a2..85faf5c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,7 +12,7 @@ services: - "5432:5432" web: build: . - command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'" + command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0 -e production'" volumes: - .:/myapp ports: