66// Set process name
77process . title = "countly: dashboard node " + process . argv [ 1 ] ;
88
9+ var fs = require ( 'fs' ) ;
10+ var path = require ( 'path' ) ;
11+ var IS_FLEX = false ;
12+
13+ if ( fs . existsSync ( path . resolve ( '/opt/deployment_env.json' ) ) ) {
14+ var deploymentConf = fs . readFileSync ( '/opt/deployment_env.json' , 'utf8' ) ;
15+ try {
16+ if ( JSON . parse ( deploymentConf ) . DEPLOYMENT_ID ) {
17+ IS_FLEX = true ;
18+ }
19+ }
20+ catch ( e ) {
21+ IS_FLEX = false ;
22+ }
23+ }
24+
925var versionInfo = require ( './version.info' ) ,
1026 pack = require ( '../../package.json' ) ,
1127 COUNTLY_VERSION = versionInfo . version ,
@@ -27,8 +43,6 @@ var versionInfo = require('./version.info'),
2743 }
2844 } ) ,
2945 crypto = require ( 'crypto' ) ,
30- fs = require ( 'fs' ) ,
31- path = require ( 'path' ) ,
3246 jimp = require ( 'jimp' ) ,
3347 flash = require ( 'connect-flash' ) ,
3448 cookieParser = require ( 'cookie-parser' ) ,
@@ -66,7 +80,13 @@ var COUNTLY_NAMED_TYPE = "Countly Lite v" + COUNTLY_VERSION;
6680var COUNTLY_TYPE_CE = true ;
6781var COUNTLY_TRIAL = ( versionInfo . trial ) ? true : false ;
6882var COUNTLY_TRACK_TYPE = "OSS" ;
69- if ( versionInfo . footer ) {
83+
84+ if ( IS_FLEX ) {
85+ COUNTLY_NAMED_TYPE = "Countly v" + COUNTLY_VERSION ;
86+ COUNTLY_TYPE_CE = false ;
87+ COUNTLY_TRACK_TYPE = "Flex" ;
88+ }
89+ else if ( versionInfo . footer ) {
7090 COUNTLY_NAMED_TYPE = versionInfo . footer ;
7191 COUNTLY_TYPE_CE = false ;
7292 if ( COUNTLY_NAMED_TYPE === "Countly Cloud" ) {
@@ -907,8 +927,9 @@ Promise.all([plugins.dbConnection(countlyConfig), plugins.dbConnection("countly_
907927 countly_tracking = plugins . isPluginEnabled ( 'tracker' ) ? true : plugins . getConfig ( 'frontend' ) . countly_tracking ,
908928 countly_domain = plugins . getConfig ( 'api' ) . domain ,
909929 licenseNotification , licenseError ;
930+ var isLocked = false ;
910931 configs . export_limit = plugins . getConfig ( "api" ) . export_limit ;
911- app . loadThemeFiles ( configs . theme , function ( theme ) {
932+ app . loadThemeFiles ( configs . theme , async function ( theme ) {
912933 if ( configs . _user . theme ) {
913934 res . cookie ( "theme" , configs . theme ) ;
914935 }
@@ -922,6 +943,13 @@ Promise.all([plugins.dbConnection(countlyConfig), plugins.dbConnection("countly_
922943 if ( member . upgrade ) {
923944 countlyDb . collection ( 'members' ) . update ( { "_id" : member . _id } , { $unset : { upgrade : "" } } , function ( ) { } ) ;
924945 }
946+ if ( IS_FLEX ) {
947+ let locked = await countlyDb . collection ( 'mycountly' ) . findOne ( { _id : 'lockServer' } ) ;
948+ if ( locked ?. isLocked === true ) {
949+ isLocked = true ;
950+ }
951+
952+ }
925953
926954 if ( req . session . licenseError ) {
927955 licenseError = req . session . licenseError ;
@@ -989,6 +1017,8 @@ Promise.all([plugins.dbConnection(countlyConfig), plugins.dbConnection("countly_
9891017 helpCenterLink : COUNTLY_HELPCENTER_LINK ,
9901018 featureRequestLink : COUNTLY_FEATUREREQUEST_LINK ,
9911019 } ,
1020+ mycountly : IS_FLEX ,
1021+ isLocked : isLocked ,
9921022 } ;
9931023
9941024
0 commit comments