move hardcoded mixpanel token to the config (#3954)

Remove hardcoded mixpanel token and move it to the config class. This will allow for injection cloud's id and distinguish Enso Ide project from Enso Cloud in mixpanel.
This commit is contained in:
Paweł Buchowski 2023-01-17 11:30:47 +01:00 committed by GitHub
parent cd172dad80
commit 8300d2f823
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 7 deletions

View File

@ -58,6 +58,7 @@ ensogl::read_args! {
node_labels : bool,
crash_report_host : String,
data_gathering : bool,
mixpanel_token : String,
is_in_cloud : bool,
verbose : bool,
authentication_enabled : bool,

View File

@ -39,7 +39,7 @@ class ContentApi {
initLogging(config: Config) {
if (config.data_gathering) {
this.logger = new MixpanelLogger()
this.logger = new MixpanelLogger(config.mixpanel_token)
if (ok(config.email)) {
this.logger.identify(config.email)
}
@ -204,13 +204,9 @@ function printScamWarning() {
class MixpanelLogger {
private readonly mixpanel: any
constructor() {
constructor(mixpanel_token: string) {
this.mixpanel = require('mixpanel-browser')
this.mixpanel.init(
'5b541aeab5e08f313cdc1d1bbebc12ac',
{ api_host: 'https://api-eu.mixpanel.com' },
''
)
this.mixpanel.init(mixpanel_token, { api_host: 'https://api-eu.mixpanel.com' }, '')
}
log(event: string, data: any) {
@ -764,6 +760,7 @@ class Config {
public node_labels: boolean = true
public crash_report_host: string = defaultLogServerHost
public data_gathering: boolean = true
public mixpanel_token: string = '5b541aeab5e08f313cdc1d1bbebc12ac'
public is_in_cloud: boolean = false
public verbose: boolean = false
public authentication_enabled: boolean = true