summaryrefslogtreecommitdiffstats
path: root/models/settings.js
diff options
context:
space:
mode:
authorguillaume <guillaume.cassou@supinfo.com>2018-07-27 18:08:09 +0200
committerguillaume <guillaume.cassou@supinfo.com>2018-07-27 18:08:09 +0200
commitec59af3777f5ac88ee6ad44a502c0de5d35213e2 (patch)
tree78c15ddc925d3e54cbca2a7b346b4c07484ff94d /models/settings.js
parentaa080a75062405d1f7734422f8dc3f2c08c96140 (diff)
downloadwekan-ec59af3777f5ac88ee6ad44a502c0de5d35213e2.tar.gz
wekan-ec59af3777f5ac88ee6ad44a502c0de5d35213e2.tar.bz2
wekan-ec59af3777f5ac88ee6ad44a502c0de5d35213e2.zip
Integration of matomo with env vars
Diffstat (limited to 'models/settings.js')
-rw-r--r--models/settings.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/models/settings.js b/models/settings.js
index 308d867d..3b9b4eae 100644
--- a/models/settings.js
+++ b/models/settings.js
@@ -96,6 +96,14 @@ if (Meteor.isServer) {
return (min + Math.round(rand * range));
}
+ function getEnvVar(name){
+ const value = process.env[name];
+ if (value){
+ return value;
+ }
+ throw new Meteor.Error(['var-not-exist', `The environment variable ${name} does not exist`]);
+ }
+
function sendInvitationEmail (_id){
const icode = InvitationCodes.findOne(_id);
const author = Users.findOne(Meteor.userId());
@@ -180,5 +188,14 @@ if (Meteor.isServer) {
email: user.emails[0].address,
};
},
+
+ getMatomoConf(){
+ return {
+ address: getEnvVar('MATOMO_ADDRESS'),
+ siteId: getEnvVar('MATOMO_SITE_ID'),
+ doNotTrack: process.env.MATOMO_DO_NOT_TRACK || false,
+ withUserName: process.env.MATOMO_WITH_USERNAME || false,
+ };
+ },
});
}