From 14b13bfa9c114d188c4a23def6c9cddcc7f2bc0e Mon Sep 17 00:00:00 2001 From: kyle Date: Mon, 26 Apr 2021 21:59:00 +0100 Subject: [PATCH] read sha from file --- common/project.js | 15 ++++++--------- server/index.js | 7 +++++++ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/common/project.js b/common/project.js index fca0ff00..8cb0f63b 100644 --- a/common/project.js +++ b/common/project.js @@ -1,19 +1,16 @@ module.exports = global.Project = { - api: 'https://api.flagsmith.com/api/v1/', + api: 'https://api-dev.flagsmith.com/api/v1/', flagsmithClientAPI: 'https://api.flagsmith.com/api/v1/', - flagsmith: '4vfqhypYjcPoGGu8ByrBaj', // This is our Bullet Train API key - Bullet Train runs on Bullet Train! - env: 'prod', // This is used for Sentry tracking - sentry: 'https://2f6eb58a3987406aaeee38d5f0c38005@o486744.ingest.sentry.io/5666694', - maintenance: false, // trigger maintenance mode - cookieDomain: '.flagsmith.com', - excludeAnalytics: 'nightwatch@solidstategroup.com', + flagsmith: '8KzETdDeMY7xkqkSkY3Gsg', // This is our Bullet Train API key - Bullet Train runs on Bullet Train! + debug: false, delighted: true, // determines whether to shw delighted feedback widget + env: 'dev', // This is used for Sentry tracking + maintenance: false, // trigger maintenance mode demoAccount: { email: 'kyle+bullet-train@solidstategroup.com', password: 'demo_account', }, chargebee: { - site: 'flagsmith', + site: 'flagsmith-test', }, - assetUrl: 'https://cdn.flagsmith.com', // Location of the static files from build/, should contain a directory called static/ }; diff --git a/server/index.js b/server/index.js index e6436306..588471d5 100755 --- a/server/index.js +++ b/server/index.js @@ -3,6 +3,8 @@ require('dotenv').config(); const bodyParser = require('body-parser'); const exphbs = require('express-handlebars'); const express = require('express'); +const fs = require('fs'); +const path = require('path'); const Project = require('../common/project'); const postToSlack = Project.env === 'prod'; @@ -39,12 +41,17 @@ app.get('/static/project-overrides.js', (req, res) => { return ` ${name}: '${value}', `; }; + let sha = ''; + if (fs.existsSync(path.join(__dirname, 'CI_COMMIT_SHA'))) { + sha = fs.readFileSync(path.join(__dirname, 'CI_COMMIT_SHA')); + } const values = [ { name: 'preventSignup', value: process.env.PREVENT_SIGNUP }, { name: 'flagsmith', value: process.env.FLAGSMITH }, { name: 'ga', value: process.env.GA }, { name: 'crispChat', value: process.env.CRISP_CHAT }, + { name: 'sha', value: sha }, { name: 'mixpanel', value: process.env.MIXPANEL }, { name: 'sentry', value: process.env.SENTRY }, { name: 'api', value: process.env.PROXY_API_URL ? '/api/v1/' : process.env.API_URL },