Move sendinblue client key to configuration file

This is not a secret (it's sent to the client as part of the JS anyway) so it's
not a big deal that it was on the public repository but it's still better to
have it be configurable.
This commit is contained in:
Frederic Merizen 2019-03-05 10:34:51 +01:00 committed by Frederic Merizen
parent 24ee81af2c
commit fc38880155
2 changed files with 3 additions and 3 deletions

View file

@ -1,6 +1,6 @@
:javascript :javascript
(function() { (function() {
window.sib = { equeue: [], client_key: "pcxtf4lpkka986pf4l1kt" }; window.sib = { equeue: [], client_key: "#{Rails.application.secrets.sendinblue[:client_key]}" };
/* OPTIONAL: email for identify request*/ /* OPTIONAL: email for identify request*/
window.sib.email_id = '#{current_administrateur.email}'; window.sib.email_id = '#{current_administrateur.email}';
window.sendinblue = {}; for (var j = ['track', 'identify', 'trackLink', 'page'], i = 0; i < j.length; i++) { (function(k) { window.sendinblue[k] = function() { var arg = Array.prototype.slice.call(arguments); (window.sib[k] || function() { var t = {}; t[k] = arg; window.sib.equeue.push(t);})(arg[0], arg[1], arg[2]);};})(j[i]);}var n = document.createElement("script"),i = document.getElementsByTagName("script")[0]; n.type = "text/javascript", n.id = "sendinblue-js", n.async = !0, n.src = "https://sibautomation.com/sa.js?key=" + window.sib.client_key, i.parentNode.insertBefore(n, i), window.sendinblue.page(); window.sendinblue = {}; for (var j = ['track', 'identify', 'trackLink', 'page'], i = 0; i < j.length; i++) { (function(k) { window.sendinblue[k] = function() { var arg = Array.prototype.slice.call(arguments); (window.sib[k] || function() { var t = {}; t[k] = arg; window.sib.equeue.push(t);})(arg[0], arg[1], arg[2]);};})(j[i]);}var n = document.createElement("script"),i = document.getElementsByTagName("script")[0]; n.type = "text/javascript", n.id = "sendinblue-js", n.async = !0, n.src = "https://sibautomation.com/sa.js?key=" + window.sib.client_key, i.parentNode.insertBefore(n, i), window.sendinblue.page();
@ -23,5 +23,3 @@
// 'nb_instructeurs' : //combien d'instructeur en tout ? // 'nb_instructeurs' : //combien d'instructeur en tout ?
// 'nb_dossiers' : //combien de dossier en tout ? // 'nb_dossiers' : //combien de dossier en tout ?
}); });

View file

@ -51,6 +51,8 @@ defaults: &defaults
client_id: <%= ENV['HELPSCOUT_CLIENT_ID'] %> client_id: <%= ENV['HELPSCOUT_CLIENT_ID'] %>
client_secret: <%= ENV['HELPSCOUT_CLIENT_SECRET'] %> client_secret: <%= ENV['HELPSCOUT_CLIENT_SECRET'] %>
webhook_secret: <%= ENV['HELPSCOUT_WEBHOOK_SECRET'] %> webhook_secret: <%= ENV['HELPSCOUT_WEBHOOK_SECRET'] %>
sendinblue:
client_key: <%= ENV['SENDINBLUE_CLIENT_KEY'] %>
development: development:
<<: *defaults <<: *defaults