-
Notifications
You must be signed in to change notification settings - Fork 902
/
settings.ts
86 lines (79 loc) · 2.2 KB
/
settings.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import {cloneDeep, merge} from 'lodash';
export interface IProviderSettings {
defaults: {};
resetToOriginal?: () => void;
}
interface INotificationSettings {
email: {
enabled: boolean;
};
hipchat: {
enabled: boolean;
botName: string;
};
sms: {
enabled: boolean;
};
slack: {
enabled: boolean;
botName: string;
};
}
export interface IFeatures {
entityTags?: boolean;
fiatEnabled?: boolean;
pipelines?: boolean;
notifications?: boolean;
clusterDiff?: boolean;
roscoMode?: boolean;
chaosMonkey?: boolean;
// whether stages affecting infrastructure (like "Create Load Balancer") should be enabled or not
infrastructureStages?: boolean;
jobs?: boolean;
snapshots?: boolean;
dockerBake?: boolean;
[key: string]: any;
}
export interface ISpinnakerSettings {
checkForUpdates: boolean;
debugEnabled: boolean;
defaultProviders: string[];
gateUrl: string;
bakeryDetailUrl: string;
authEndpoint: string;
pollSchedule: number;
defaultTimeZone: string; // see http://momentjs.com/timezone/docs/#/data-utilities/
defaultCategory: string;
defaultInstancePort: number;
providers?: {
[key: string]: IProviderSettings; // allows custom providers not typed in here (good for testing too)
};
notifications: INotificationSettings;
authEnabled: boolean;
authTtl: number;
gitSources: string[];
triggerTypes: string[];
analytics: {
ga?: boolean;
};
feature: IFeatures;
executionWindow?: {
atlas?: {
regions: { label: string, baseUrl: string }[];
url: string;
}
};
entityTags?: {
maxUrlLength?: number;
};
[key: string]: any;
resetToOriginal: () => void;
}
export const SETTINGS: ISpinnakerSettings = (<any>window).spinnakerSettings;
// Make sure to set up some reasonable default settings fields so we do not have to keep checking if they exist everywhere
SETTINGS.feature = SETTINGS.feature || {};
SETTINGS.analytics = SETTINGS.analytics || {};
SETTINGS.providers = SETTINGS.providers || {};
// A helper to make resetting settings to steady state after running tests easier
const originalSettings: ISpinnakerSettings = cloneDeep(SETTINGS);
SETTINGS.resetToOriginal = () => { merge(SETTINGS, originalSettings); };