2016-02-01 17:37:37 +01:00
|
|
|
namespace :dev do
|
|
|
|
desc 'Initialise dev environment'
|
|
|
|
task :init do
|
|
|
|
puts 'start initialisation'
|
2016-02-02 10:24:36 +01:00
|
|
|
Rake::Task['dev:generate_token_file'].invoke
|
|
|
|
Rake::Task['dev:generate_franceconnect_file'].invoke
|
|
|
|
|
2016-02-01 17:37:37 +01:00
|
|
|
puts 'end initialisation'
|
|
|
|
end
|
|
|
|
|
2016-02-02 10:24:36 +01:00
|
|
|
task :generate_token_file do
|
|
|
|
puts 'creating token.rb file'
|
|
|
|
res = `rake secret`.gsub("\n", '')
|
|
|
|
file = File.new('config/initializers/token.rb', 'w+')
|
|
|
|
comment = <<EOF
|
2016-02-01 17:37:37 +01:00
|
|
|
EOF
|
2016-02-02 10:24:36 +01:00
|
|
|
file.write(comment)
|
|
|
|
file.write("TPS::Application.config.SIADETOKEN = '#{res}'")
|
2016-02-01 17:37:37 +01:00
|
|
|
file.close
|
|
|
|
end
|
|
|
|
|
2016-02-02 10:24:36 +01:00
|
|
|
task :generate_franceconnect_file do
|
|
|
|
file = File.new('config/france_connect.yml', 'w+')
|
2016-02-01 17:37:37 +01:00
|
|
|
comment = <<EOF
|
2016-02-02 10:24:36 +01:00
|
|
|
particulier_identifier: plop
|
|
|
|
particulier_secret: plip
|
2016-02-01 17:37:37 +01:00
|
|
|
|
2016-02-02 10:24:36 +01:00
|
|
|
particulier_redirect_uri: 'http://localhost:3000/france_connect/particulier/callback'
|
2016-02-01 17:37:37 +01:00
|
|
|
|
2016-02-02 10:24:36 +01:00
|
|
|
particulier_authorization_endpoint: 'https://fcp.integ01.dev-franceconnect.fr/api/v1/authorize'
|
|
|
|
particulier_token_endpoint: 'https://fcp.integ01.dev-franceconnect.fr/api/v1/token'
|
|
|
|
particulier_userinfo_endpoint: 'https://fcp.integ01.dev-franceconnect.fr/api/v1/userinfo'
|
|
|
|
particulier_logout_endpoint: 'https://fcp.integ01.dev-franceconnect.fr/api/v1/logout'
|
2016-02-01 17:37:37 +01:00
|
|
|
EOF
|
|
|
|
file.write(comment)
|
|
|
|
file.close
|
|
|
|
end
|
|
|
|
end
|