• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

SAP / feature-toggle-node / 891991c4-7a14-4989-ac56-e39cc2abe6fb

10 Mar 2025 12:40PM UTC coverage: 100.0%. Remained the same
891991c4-7a14-4989-ac56-e39cc2abe6fb

Pull #244

circleci

i053322
docs:  update chanelog 2.0.3
Pull Request #244: docs: update chanelog 2.0.3

53 of 53 branches covered (100.0%)

Branch coverage included in aggregate %.

106 of 106 relevant lines covered (100.0%)

3.71 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/src/current_context.ts
1
import { getEnv, getEnvWithError } from "./utils";
1✔
2

3
const USER_NAME = "USER_NAME";
1✔
4
const LANDSCAPE_ENVIRONMENT = "LANDSCAPE_ENVIRONMENT";
1✔
5
const LANDSCAPE_NAME = "LANDSCAPE_NAME";
1✔
6
const TENANT_ID = "TENANT_ID";
1✔
7
const SUB_ACCOUNT = "TENANT_NAME";
1✔
8
const WORKSPACE_ID = "WORKSPACE_ID";
1✔
9
const LANDSCAPE_INFRASTRUCTURE = "LANDSCAPE_INFRASTRUCTURE";
1✔
10

11
export type ContextData = {
12
  environment: string;
13
  infrastructure: string;
14
  landscape: string;
15
  subaccount: string;
16
  user: string;
17
  ws: string;
18
  tenantid: string;
19
};
20

21
function getEnvWithNotFoundError(envVar: string): string {
22
  return getEnvWithError(envVar, `Feature toggle env ${envVar} was NOT found in the environment variables`);
6✔
23
}
24

25
export function createContextEntity(): ContextData {
1✔
26
  // get the user name from the env
27
  const user = getEnvWithNotFoundError(USER_NAME);
1✔
28
  // get the environment from the env
29
  const environment = getEnvWithNotFoundError(LANDSCAPE_ENVIRONMENT);
1✔
30
  // get the landscape from the env
31
  const landscape = getEnvWithNotFoundError(LANDSCAPE_NAME);
1✔
32
  // get the tenant id from the env
33
  const tenantid = getEnvWithNotFoundError(TENANT_ID);
1✔
34
  // get the tenant id from the env
35
  const subaccount = getEnvWithNotFoundError(SUB_ACCOUNT);
1✔
36
  // get WORKSPACE_ID env
37
  const ws = getEnvWithNotFoundError(WORKSPACE_ID);
1✔
38
  // get LANDSCAPE_INFRASTRUCTURE env or empty string if not found
39
  const infrastructure = getEnv(LANDSCAPE_INFRASTRUCTURE);
1✔
40

41
  // Create the context
42
  return {
1✔
43
    environment,
44
    infrastructure,
45
    landscape,
46
    subaccount,
47
    user,
48
    ws,
49
    tenantid,
50
  };
51
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc