[ENV] France connect particulier config in secrets.yml
This commit is contained in:
parent
46bb8df5cd
commit
238d94cdc3
2 changed files with 23 additions and 22 deletions
|
@ -1,22 +1,3 @@
|
|||
FRANCE_CONNECT = if Rails.env.test?
|
||||
{
|
||||
particulier: {
|
||||
identifier: 'plop',
|
||||
secret: 'plip',
|
||||
redirect_uri: 'https://bidon.com/endpoint',
|
||||
authorization_endpoint: 'https://bidon.com/endpoint',
|
||||
token_endpoint: 'https://bidon.com/endpoint',
|
||||
userinfo_endpoint: 'https://bidon.com/endpoint',
|
||||
logout_endpoint: 'https://bidon.com/endpoint',
|
||||
}
|
||||
}
|
||||
else
|
||||
fc_config_file_path = Rails.root.join("config", "france_connect.yml")
|
||||
|
||||
# FIXME: with a yaml with a { particulier: {} } structure
|
||||
config_hash = YAML.safe_load(File.read(fc_config_file_path))
|
||||
.reduce({}) { |acc, (key, value)| acc[key.gsub('particulier_', '')] = value; acc }
|
||||
.symbolize_keys
|
||||
|
||||
{ particulier: config_hash }
|
||||
end
|
||||
FRANCE_CONNECT = {
|
||||
particulier: Rails.application.secrets.france_connect_particulier
|
||||
}
|
||||
|
|
|
@ -9,14 +9,34 @@
|
|||
|
||||
# Make sure the secrets in this file are kept private
|
||||
# if you're sharing your code publicly.
|
||||
defaults: &defaults
|
||||
france_connect_particulier:
|
||||
identifier: <%= ENV['FC_PARTICULIER_ID'] %>
|
||||
secret: <%= ENV['FC_PARTICULIER_SECRET'] %>
|
||||
redirect_uri: <%= ENV['FC_PARTICULIER_REDIRECT_URI'] %>
|
||||
authorization_endpoint: <%= ENV['FC_PARTICULIER_HOST'] %>/api/v1/authorize
|
||||
token_endpoint: <%= ENV['FC_PARTICULIER_HOST'] %>/api/v1/token
|
||||
userinfo_endpoint: <%= ENV['FC_PARTICULIER_HOST'] %>/api/v1/userinfo
|
||||
logout_endpoint: <%= ENV['FC_PARTICULIER_HOST'] %>/api/v1/logout
|
||||
|
||||
development:
|
||||
<<: *defaults
|
||||
secret_key_base: 05a2d479d8e412198dabd08ef0eee9d6e180f5cbb48661a35fd1cae287f0a93d40b5f1da08f06780d698bbd458a0ea97f730f83ee780de5d4e31f649a0130cf0
|
||||
|
||||
test:
|
||||
<<: *defaults
|
||||
secret_key_base: aa52abc3f3a629d04a61e9899a24c12f52b24c679cbf45f8ec0cdcc64ab9526d673adca84212882dff3911ac98e0c32ec4729ca7b3429ba18ef4dfd1bd18bc7a
|
||||
france_connect_particulier:
|
||||
identifier: france_connect_test_identifier
|
||||
secret: france_connect_test_secret
|
||||
redirect_uri: https://bidon.com/endpoint
|
||||
authorization_endpoint: https://bidon.com/endpoint
|
||||
token_endpoint: https://bidon.com/endpoint
|
||||
userinfo_endpoint: https://bidon.com/endpoint
|
||||
logout_endpoint: https://bidon.com/endpoint
|
||||
|
||||
# Do not keep production secrets in the repository,
|
||||
# instead read values from the environment.
|
||||
production:
|
||||
<<: *defaults
|
||||
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
||||
|
|
Loading…
Reference in a new issue