Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different environments not working #208

Closed
sathishcst10 opened this issue Feb 5, 2024 · 5 comments
Closed

Different environments not working #208

sathishcst10 opened this issue Feb 5, 2024 · 5 comments

Comments

@sathishcst10
Copy link

Hi
I'm using FlagSmith for my project, its have three different environment like Dev, staging, prod,
In flagSmith calling method i using different Identity keys, but still its calling only Development Environment from flagSmith.

flagsmith.init({
  environmentID : 'dev-env-id',
  cacheFlags : true,
  enableAnalytics : false,  
  identity : environment.user_identity
})
flagsmith.init({
  environmentID : 'stage-env-id',
  cacheFlags : true,
  enableAnalytics : false,  
  identity : environment.user_identity
})

In my angular code sent the stage-env-id but still in the "X-Environment-Key" header dev env id only passed.

please check and fix this asap

@matthewelwell
Copy link
Contributor

@sathishcst10 can you share more code here? Are you initialising the client more than once in a given session?

@sathishcst10
Copy link
Author

Hi,
No, I'm just initializing the client only once, the environmentID , came from the env file in angular.

@dabeeeenster
Copy link
Contributor

You don't have flagsmith.init more than once in your codebase?

@sathishcst10
Copy link
Author

Yes,
I create service module and initialize flagsmith.init once and I use it across the components, look at the sample code, which im using

import { Injectable } from '@angular/core';
import flagsmith from 'flagsmith';
import { environment } from 'src/environments/environment';

flagsmith.init({
  environmentID : environment.config_identity,
  cacheFlags : true,
  enableAnalytics : false,  
  identity : environment.user_identity
})
@Injectable({
  providedIn: 'root'
})
export class ConfigFlagsService {
  logs! : any;
  constructor() {  
  }

  get_app_name(){
    return flagsmith.getValue('app_name')
  }
}

@dabeeeenster
Copy link
Contributor

You must be passing in the incorrect environment key.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants