mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-25 22:31:36 +01:00
0b66cfbc8d
Some checks failed
Bundler Audit / security (push) Has been cancelled
Check i18n / check-i18n (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
CodeQL / Analyze (ruby) (push) Has been cancelled
Crowdin / Upload translations / upload-translations (push) Has been cancelled
Check formatting / lint (push) Has been cancelled
CSS Linting / lint (push) Has been cancelled
Haml Linting / lint (push) Has been cancelled
JavaScript Linting / lint (push) Has been cancelled
Ruby Linting / lint (push) Has been cancelled
JavaScript Testing / test (push) Has been cancelled
Historical data migration test / test (14-alpine) (push) Has been cancelled
Historical data migration test / test (15-alpine) (push) Has been cancelled
Ruby Testing / build (production) (push) Has been cancelled
Ruby Testing / build (test) (push) Has been cancelled
Ruby Testing / test (.ruby-version) (push) Has been cancelled
Ruby Testing / test (3.1) (push) Has been cancelled
Ruby Testing / test (3.2) (push) Has been cancelled
Ruby Testing / Libvips tests (.ruby-version) (push) Has been cancelled
Ruby Testing / Libvips tests (3.1) (push) Has been cancelled
Ruby Testing / Libvips tests (3.2) (push) Has been cancelled
Ruby Testing / End to End testing (.ruby-version) (push) Has been cancelled
Ruby Testing / End to End testing (3.1) (push) Has been cancelled
Ruby Testing / End to End testing (3.2) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:8.10.2) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (.ruby-version, opensearchproject/opensearch:2) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (3.1, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (3.2, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Has been cancelled
41 lines
1.5 KiB
Ruby
41 lines
1.5 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
%w(
|
|
ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY
|
|
ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT
|
|
ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY
|
|
).each do |key|
|
|
if ENV['SECRET_KEY_BASE_DUMMY']
|
|
# Use placeholder value during production env asset compilation
|
|
ENV[key] = SecureRandom.hex(64)
|
|
end
|
|
|
|
value = ENV.fetch(key) do
|
|
abort <<~MESSAGE
|
|
|
|
Catstodon now requires that these variables are set:
|
|
|
|
- ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY
|
|
- ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT
|
|
- ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY
|
|
|
|
Run `bin/rails db:encryption:init` to generate new secrets and then assign the environment variables.
|
|
MESSAGE
|
|
end
|
|
|
|
next unless Rails.env.production? && value.end_with?('DO_NOT_USE_IN_PRODUCTION')
|
|
|
|
abort <<~MESSAGE
|
|
|
|
It looks like you are trying to run Mastodon in production with a #{key} value from the test environment.
|
|
|
|
Please generate fresh secrets using `bin/rails db:encryption:init` and use them instead.
|
|
MESSAGE
|
|
end
|
|
|
|
Rails.application.configure do
|
|
config.active_record.encryption.deterministic_key = ENV.fetch('ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY')
|
|
config.active_record.encryption.key_derivation_salt = ENV.fetch('ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT')
|
|
config.active_record.encryption.primary_key = ENV.fetch('ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY')
|
|
config.active_record.encryption.support_sha1_for_non_deterministic_encryption = true
|
|
end
|