From 8748c792dbd112488dead11f743697e6731fe3ef Mon Sep 17 00:00:00 2001 From: riggraz Date: Thu, 9 Jan 2025 21:37:07 +0100 Subject: [PATCH] Rename some env vars --- .github/workflows/run-tests.yml | 4 ++-- Dockerfile | 2 +- app/models/user.rb | 2 +- config/environments/development.rb | 2 +- config/environments/production.rb | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index d4cf2fdf..9aa9d2df 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -17,10 +17,10 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Set PRIVATE_ACTIVE_STORAGE_SERVICE to local in docker-compose.yml + - name: Set ACTIVE_STORAGE_PRIVATE_SERVICE to local in docker-compose.yml uses: mikefarah/yq@master with: - cmd: yq eval '.services.web.environment["PRIVATE_ACTIVE_STORAGE_SERVICE"] = "test"' -i docker-compose.yml + cmd: yq eval '.services.web.environment["ACTIVE_STORAGE_PRIVATE_SERVICE"] = "test"' -i docker-compose.yml - name: Build Docker production image run: docker compose -f docker-compose.yml -f docker-compose-prod.yml build --build-arg ENVIRONMENT=production diff --git a/Dockerfile b/Dockerfile index 6b0ee161..e6c3a9d9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -42,7 +42,7 @@ RUN RSWAG_SWAGGERIZE=true RAILS_ENV=test bundle exec rake rswag:specs:swaggerize # Compile assets if production # SECRET_KEY_BASE=1 is a workaround (see https://github.com/rails/rails/issues/32947) -RUN if [ "$ENVIRONMENT" = "production" ]; then SECRET_KEY_BASE=1 PRIVATE_ACTIVE_STORAGE_SERVICE=test ./bin/rails assets:precompile; fi +RUN if [ "$ENVIRONMENT" = "production" ]; then SECRET_KEY_BASE=1 ACTIVE_STORAGE_PRIVATE_SERVICE=test ./bin/rails assets:precompile; fi ### ### Dev stage ### diff --git a/app/models/user.rb b/app/models/user.rb index 0294cfd0..0fc9146d 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -11,7 +11,7 @@ class User < ApplicationRecord has_many :likes, dependent: :destroy has_many :comments, dependent: :destroy has_one :api_key, dependent: :destroy - has_one_attached :avatar, service: ENV.fetch('PUBLIC_ACTIVE_STORAGE_SERVICE', :local).to_sym + has_one_attached :avatar, service: ENV.fetch('ACTIVE_STORAGE_PUBLIC_SERVICE', :local).to_sym enum role: [:user, :moderator, :admin, :owner] enum status: [:active, :blocked, :deleted] diff --git a/config/environments/development.rb b/config/environments/development.rb index d1e05a4e..885b7ccd 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -64,7 +64,7 @@ Rails.application.configure do } # Store uploaded files on the local file system (see config/storage.yml for options). - config.active_storage.service = ENV.fetch('PRIVATE_ACTIVE_STORAGE_SERVICE') { :local } + config.active_storage.service = ENV.fetch('ACTIVE_STORAGE_PRIVATE_SERVICE') { :local } # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = ActiveModel::Type::Boolean.new.cast(ENV.fetch("EMAIL_RAISE_DELIVERY_ERRORS", "false")) diff --git a/config/environments/production.rb b/config/environments/production.rb index 3b65f724..9d679f51 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -36,7 +36,7 @@ Rails.application.configure do # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX # Store uploaded files on the local file system (see config/storage.yml for options). - config.active_storage.service = ENV.fetch('PRIVATE_ACTIVE_STORAGE_SERVICE') { :local } + config.active_storage.service = ENV.fetch('ACTIVE_STORAGE_PRIVATE_SERVICE') { :local } # Mount Action Cable outside main process or domain. # config.action_cable.mount_path = nil