demarches-normaliennes/config/initializers/france_connect.rb

23 lines
731 B
Ruby
Raw Normal View History

2018-01-11 14:37:53 +01:00
FRANCE_CONNECT = if Rails.env.test?
2018-01-11 14:04:24 +01:00
{
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',
}
2018-01-11 14:04:24 +01:00
}
2018-01-11 14:37:53 +01:00
else
2018-03-06 13:44:29 +01:00
fc_config_file_path = Rails.root.join("config", "france_connect.yml")
2018-01-11 14:37:53 +01:00
# 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