-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update dockerfile and fix login form
- Loading branch information
Showing
12 changed files
with
102 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Add this entry to the credentials of the target environment: active_record_encryption: primary_key: KTaBWiNQPweX14RkZ45SlqALDgHzN29j deterministic_key: XU6dYsKrdIGXdN4ExlDnp02xPEWN3LEo key_derivation_salt: 80BTLjQPA0U5O3vvAFQ0W0k5WhrmUFnR bin/rails credentials:edit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Add this entry to the credentials of the target environment: active_record_encryption: primary_key: fSTdCcdkL2gqREGZRruBGpaVWo4lwYFR deterministic_key: 9JnNhfymGDeKIKdNABAGO7mwzCBdI7aS key_derivation_salt: TFdLjYpQRHcUXkEbZhU744n5apG9lz5q rails credentials:edit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
encryption_key: abcd1234 rails credentials:edit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,18 @@ | ||
#!/bin/bash -e | ||
|
||
# If running the rails server then create or migrate existing database | ||
generate_credentials() { | ||
if [ ! -f "config/master.key" ] || [ ! -f "config/credentials.yml.enc" ]; then | ||
echo "Generating master key and credentials..." | ||
rm -f config/master.key config/credentials.yml.enc | ||
# Generate credentials | ||
EDITOR="mate --wait" rails credentials:edit | ||
fi | ||
} | ||
|
||
# Generate credentials | ||
generate_credentials | ||
|
||
./bin/rails db:prepare | ||
|
||
exec "${@}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
begin | ||
credentials = Rails.application.credentials | ||
|
||
unless credentials.dig(:active_record_encryption, :primary_key) && | ||
credentials.dig(:active_record_encryption, :deterministic_key) && | ||
credentials.dig(:active_record_encryption, :key_derivation_salt) | ||
new_keys = { | ||
active_record_encryption: { | ||
primary_key: SecureRandom.hex(16), | ||
deterministic_key: SecureRandom.hex(16), | ||
key_derivation_salt: SecureRandom.hex(16) | ||
} | ||
} | ||
|
||
encrypted = ActiveSupport::EncryptedConfiguration.new( | ||
config_path: "config/credentials.yml.enc", | ||
key_path: "config/master.key", | ||
env_key: "RAILS_MASTER_KEY", | ||
raise_if_missing_key: true | ||
) | ||
|
||
current_credentials = YAML.load(encrypted.read) || {} | ||
updated_credentials = current_credentials.deep_merge(new_keys) | ||
encrypted.write(updated_credentials.to_yaml) | ||
end | ||
rescue => e | ||
nil | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
$(bin/rails db:encryption:init) credentials:edit |