Skip to content

Commit

Permalink
fix(core): Fix for deck breaking if some default settings are missing
Browse files Browse the repository at this point in the history
  • Loading branch information
jrsquared committed Mar 27, 2017
1 parent 093666a commit 987e1f3
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 38 deletions.
14 changes: 7 additions & 7 deletions app/scripts/modules/amazon/aws.settings.ts
Expand Up @@ -7,25 +7,25 @@ interface IClassicLaunchWhitelist {

export interface IAWSProviderSettings extends IProviderSettings {
defaults: {
account: string;
region: string;
iamRole: string;
account?: string;
region?: string;
iamRole?: string;
subnetType?: string;
};
defaultSecurityGroups: string[];
loadBalancers: {
defaultSecurityGroups?: string[];
loadBalancers?: {
inferInternalFlagFromSubnet: boolean;
certificateTypes?: string[];
};
useAmiBlockDeviceMappings: boolean;
useAmiBlockDeviceMappings?: boolean;
classicLaunchLockout?: number;
classicLaunchWhitelist?: IClassicLaunchWhitelist[];
metrics?: {
customNamespaces?: string[];
};
}

export const AWSProviderSettings: IAWSProviderSettings = <IAWSProviderSettings>SETTINGS.providers.aws;
export const AWSProviderSettings: IAWSProviderSettings = <IAWSProviderSettings>SETTINGS.providers.aws || { defaults: {} };
if (AWSProviderSettings) {
AWSProviderSettings.resetToOriginal = SETTINGS.resetToOriginal;
}
6 changes: 3 additions & 3 deletions app/scripts/modules/appengine/appengine.settings.ts
Expand Up @@ -2,12 +2,12 @@ import { IProviderSettings, SETTINGS } from 'core/config/settings';

export interface IAppengineProviderSettings extends IProviderSettings {
defaults: {
account: string;
editLoadBalancerStageEnabled: boolean;
account?: string;
editLoadBalancerStageEnabled?: boolean;
};
}

export const AppengineProviderSettings: IAppengineProviderSettings = <IAppengineProviderSettings>SETTINGS.providers.appengine;
export const AppengineProviderSettings: IAppengineProviderSettings = <IAppengineProviderSettings>SETTINGS.providers.appengine || { defaults: {} };
if (AppengineProviderSettings) {
AppengineProviderSettings.resetToOriginal = SETTINGS.resetToOriginal;
}
6 changes: 3 additions & 3 deletions app/scripts/modules/azure/azure.settings.ts
Expand Up @@ -2,12 +2,12 @@ import { IProviderSettings, SETTINGS } from 'core/config/settings';

export interface IAzureProviderSettings extends IProviderSettings {
defaults: {
account: string;
region: string;
account?: string;
region?: string;
};
}

export const AzureProviderSettings: IAzureProviderSettings = <IAzureProviderSettings>SETTINGS.providers.azure;
export const AzureProviderSettings: IAzureProviderSettings = <IAzureProviderSettings>SETTINGS.providers.azure || { defaults: {} };
if (AzureProviderSettings) {
AzureProviderSettings.resetToOriginal = SETTINGS.resetToOriginal;
}
6 changes: 3 additions & 3 deletions app/scripts/modules/cloudfoundry/cf.settings.ts
Expand Up @@ -2,12 +2,12 @@ import { IProviderSettings, SETTINGS } from 'core/config/settings';

export interface ICloudFoundryProviderSettings extends IProviderSettings {
defaults: {
account: string;
region: string;
account?: string;
region?: string;
};
}

export const CloudFoundryProviderSettings: ICloudFoundryProviderSettings = <ICloudFoundryProviderSettings>SETTINGS.providers.cf;
export const CloudFoundryProviderSettings: ICloudFoundryProviderSettings = <ICloudFoundryProviderSettings>SETTINGS.providers.cf || { defaults: {} };
if (CloudFoundryProviderSettings) {
CloudFoundryProviderSettings.resetToOriginal = SETTINGS.resetToOriginal;
}
6 changes: 2 additions & 4 deletions app/scripts/modules/core/config/settings.ts
@@ -1,10 +1,8 @@
import {cloneDeep, merge} from 'lodash';

export interface IProviderSettings {
defaults: {
account: string;
};
resetToOriginal: () => void;
defaults: {};
resetToOriginal?: () => void;
}

interface INotificationSettings {
Expand Down
Expand Up @@ -11,7 +11,7 @@ module.exports = angular
var notificationTypes = [];

function registerNotificationType(config) {
config.config = SETTINGS.notifications[config.key] || { enabled: true };
config.config = SETTINGS.notifications && SETTINGS.notifications[config.key] || { enabled: true };
notificationTypes.push(config);
}

Expand Down
8 changes: 4 additions & 4 deletions app/scripts/modules/google/gce.settings.ts
Expand Up @@ -2,13 +2,13 @@ import { IProviderSettings, SETTINGS } from 'core/config/settings';

export interface IGCEProviderSettings extends IProviderSettings {
defaults: {
account: string;
region: string;
zone: string;
account?: string;
region?: string;
zone?: string;
};
}

export const GCEProviderSettings: IGCEProviderSettings = <IGCEProviderSettings>SETTINGS.providers.gce;
export const GCEProviderSettings: IGCEProviderSettings = <IGCEProviderSettings>SETTINGS.providers.gce || { defaults: {} };
if (GCEProviderSettings) {
GCEProviderSettings.resetToOriginal = SETTINGS.resetToOriginal;
}
8 changes: 4 additions & 4 deletions app/scripts/modules/kubernetes/kubernetes.settings.ts
Expand Up @@ -2,13 +2,13 @@ import { IProviderSettings, SETTINGS } from 'core/config/settings';

export interface IKubernetesProviderSettings extends IProviderSettings {
defaults: {
account: string;
namespace: string;
proxy: string;
account?: string;
namespace?: string;
proxy?: string;
};
}

export const KubernetesProviderSettings: IKubernetesProviderSettings = <IKubernetesProviderSettings>SETTINGS.providers.kubernetes;
export const KubernetesProviderSettings: IKubernetesProviderSettings = <IKubernetesProviderSettings>SETTINGS.providers.kubernetes || { defaults: {} };
if (KubernetesProviderSettings) {
KubernetesProviderSettings.resetToOriginal = SETTINGS.resetToOriginal;
}
4 changes: 2 additions & 2 deletions app/scripts/modules/netflix/netflix.settings.ts
Expand Up @@ -22,12 +22,12 @@ export interface INetflixSettings extends ISpinnakerSettings {
helpChannelName: string;
}
};
feedbackUrl: string;
feedbackUrl?: string;
tableau?: {
appSourceUrl: string;
summarySourceUrl: string;
};
whatsNew: {
whatsNew?: {
gistId: string;
fileName: string;
accessToken?: string;
Expand Down
6 changes: 3 additions & 3 deletions app/scripts/modules/openstack/openstack.settings.ts
Expand Up @@ -2,12 +2,12 @@ import { IProviderSettings, SETTINGS } from 'core/config/settings';

export interface IOpenStackProviderSettings extends IProviderSettings {
defaults: {
account: string;
region: string;
account?: string;
region?: string;
};
}

export const OpenStackProviderSettings: IOpenStackProviderSettings = <IOpenStackProviderSettings>SETTINGS.providers.openstack;
export const OpenStackProviderSettings: IOpenStackProviderSettings = <IOpenStackProviderSettings>SETTINGS.providers.openstack || { defaults: {} };
if (OpenStackProviderSettings) {
OpenStackProviderSettings.resetToOriginal = SETTINGS.resetToOriginal;
}
8 changes: 4 additions & 4 deletions app/scripts/modules/titus/titus.settings.ts
Expand Up @@ -2,13 +2,13 @@ import { IProviderSettings, SETTINGS } from 'core/config/settings';

export interface ITitusProviderSettings extends IProviderSettings {
defaults: {
account: string;
region: string;
iamProfile: string;
account?: string;
region?: string;
iamProfile?: string;
};
}

export const TitusProviderSettings: ITitusProviderSettings = <ITitusProviderSettings>SETTINGS.providers.titus;
export const TitusProviderSettings: ITitusProviderSettings = <ITitusProviderSettings>SETTINGS.providers.titus || { defaults: {} };
if (TitusProviderSettings) {
TitusProviderSettings.resetToOriginal = SETTINGS.resetToOriginal;
}

0 comments on commit 987e1f3

Please sign in to comment.