Skip to content

Commit 1aac145

Browse files
committed
Refactor fastly API client
1 parent 1c30115 commit 1aac145

File tree

15 files changed

+1018
-699
lines changed

15 files changed

+1018
-699
lines changed

ab-testing/config/lib/config.ts

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,15 @@ const configStruct = object({
1717
abTestsDictionaryName: string(),
1818
});
1919

20-
const config = JSON.parse(getEnv("FASTLY_AB_TESTING_CONFIG")) as unknown;
20+
const getConfigFromEnv = () => {
21+
const config = JSON.parse(getEnv("FASTLY_AB_TESTING_CONFIG")) as unknown;
22+
assert(config, configStruct);
2123

22-
const apiToken = getEnv("FASTLY_API_TOKEN");
23-
24-
assert(config, configStruct);
25-
26-
const {
27-
serviceName,
28-
serviceId,
29-
mvtDictionaryId,
30-
mvtDictionaryName,
31-
abTestsDictionaryId,
32-
abTestsDictionaryName,
33-
} = config;
34-
35-
export {
36-
apiToken,
37-
serviceName,
38-
serviceId,
39-
mvtDictionaryId,
40-
mvtDictionaryName,
41-
abTestsDictionaryId,
42-
abTestsDictionaryName,
24+
return config;
4325
};
26+
const getApiTokenFromEnv = () => {
27+
const apiToken = getEnv("FASTLY_API_TOKEN");
28+
return apiToken;
29+
};
30+
31+
export { getConfigFromEnv, getApiTokenFromEnv, getEnv, configStruct };

ab-testing/config/lib/fastly-api.test.ts

Lines changed: 0 additions & 321 deletions
This file was deleted.

0 commit comments

Comments
 (0)