Environments Within a Project

Hi,

For my use case, I really need a way to specify different values of a key based on the environment an application is running in. For example, let’s say I have a key called MY_NEAT_API_KEY in a project called My_API.

Within My_API I want three environments DEV, STAGING, and PROD. MY_NEAT_API_KEY would have a different value for each environment. Then in an SDK client, I could specify which environment I want keys for.

For the sake of example, using the node SDK (with typescript here) the client setting could have an extra parameter “environment”

    const settings: ClientSettings = {
      apiUrl: apiUrl,
      identityUrl: identityUrl,
      userAgent: "bitwarden/sm-action",
      deviceType: DeviceType.SDK,
      environment: 'DEV'
    };
    const client = new BitwardenClient(settings, LogLevel.Info);
    const result = await client.loginWithAccessToken(accessToken);
    if (!result.success) {
      throw Error("Authentication to Bitwarden failed");
    }

   const MY_NEAT_API_KEY_UUID = '8e42803f-7c97-4920-b924-b06201015ceb';
   const key = await client.secrets().get(MY_NEAT_API_KEY_UUID);

Good work by the team so far, I like what I see! I would love to use this at work, but at the moment this just won’t quite meet our requirements.

1 Like

Thanks so much for the feedback! Environments within Projects is something we are currently working on for upcoming releases.

4 Likes