Skip to content

Commit f18d132

Browse files
author
Andrew Farries
committed
Rename stripe settings to stripe secrets
1 parent 0649647 commit f18d132

File tree

6 files changed

+16
-12
lines changed

6 files changed

+16
-12
lines changed

.werft/jobs/build/installer/installer.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ export class Installer {
8181
if (this.options.withPayment) {
8282
// let installer know that there is a chargbee config
8383
exec(`yq w -i ${this.options.installerConfigPath} experimental.webapp.server.chargebeeSecret chargebee-config`, { slice: slice });
84+
8485
// let installer know that there is a stripe config
8586
exec(`yq w -i ${this.options.installerConfigPath} experimental.webapp.server.stripeSecret stripe-api-keys`, { slice: slice });
8687
}

components/server/ee/src/user/stripe-service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ export class StripeService {
1717

1818
protected getStripe(): Stripe {
1919
if (!this._stripe) {
20-
if (!this.config.stripeSettings?.secretKey) {
20+
if (!this.config.stripeSecrets?.secretKey) {
2121
throw new Error("Stripe is not properly configured");
2222
}
23-
this._stripe = new Stripe(this.config.stripeSettings.secretKey, { apiVersion: "2020-08-27" });
23+
this._stripe = new Stripe(this.config.stripeSecrets.secretKey, { apiVersion: "2020-08-27" });
2424
}
2525
return this._stripe;
2626
}

components/server/ee/src/workspace/gitpod-server-impl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1851,7 +1851,7 @@ export class GitpodServerEEImpl extends GitpodServerImpl {
18511851
async getStripePublishableKey(ctx: TraceContext): Promise<string> {
18521852
const user = this.checkAndBlockUser("getStripePublishableKey");
18531853
await this.ensureIsUsageBasedFeatureFlagEnabled(user);
1854-
const publishableKey = this.config.stripeSettings?.publishableKey;
1854+
const publishableKey = this.config.stripeSecrets?.publishableKey;
18551855
if (!publishableKey) {
18561856
throw new ResponseError(
18571857
ErrorCodes.INTERNAL_SERVER_ERROR,

components/server/src/config.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ import { filePathTelepresenceAware } from "@gitpod/gitpod-protocol/lib/env";
2020
export const Config = Symbol("Config");
2121
export type Config = Omit<
2222
ConfigSerialized,
23-
"blockedRepositories" | "hostUrl" | "chargebeeProviderOptionsFile" | "stripeSettingsFile" | "licenseFile"
23+
"blockedRepositories" | "hostUrl" | "chargebeeProviderOptionsFile" | "stripeSecretsFile" | "licenseFile"
2424
> & {
2525
hostUrl: GitpodHostUrl;
2626
workspaceDefaults: WorkspaceDefaults;
2727
chargebeeProviderOptions?: ChargebeeProviderOptions;
28-
stripeSettings?: { publishableKey: string; secretKey: string };
28+
stripeSecrets?: { publishableKey: string; secretKey: string };
2929
builtinAuthProvidersConfigured: boolean;
3030
blockedRepositories: { urlRegExp: RegExp; blockUser: boolean }[];
3131
inactivityPeriodForRepos?: number;
@@ -151,7 +151,7 @@ export interface ConfigSerialized {
151151
* Payment related options
152152
*/
153153
chargebeeProviderOptionsFile?: string;
154-
stripeSettingsFile?: string;
154+
stripeSecretsFile?: string;
155155
enablePayment?: boolean;
156156

157157
/**
@@ -215,12 +215,14 @@ export namespace ConfigFile {
215215
const chargebeeProviderOptions = readOptionsFromFile(
216216
filePathTelepresenceAware(config.chargebeeProviderOptionsFile || ""),
217217
);
218-
let stripeSettings: { publishableKey: string; secretKey: string } | undefined;
219-
if (config.enablePayment && config.stripeSettingsFile) {
218+
let stripeSecrets: { publishableKey: string; secretKey: string } | undefined;
219+
if (config.enablePayment && config.stripeSecretsFile) {
220220
try {
221-
stripeSettings = JSON.parse(fs.readFileSync(filePathTelepresenceAware(config.stripeSettingsFile), "utf-8"));
221+
stripeSecrets = JSON.parse(
222+
fs.readFileSync(filePathTelepresenceAware(config.stripeSecretsFile), "utf-8"),
223+
);
222224
} catch (error) {
223-
console.error("Could not load Stripe settings", error);
225+
console.error("Could not load Stripe secrets", error);
224226
}
225227
}
226228
let license = config.license;
@@ -249,7 +251,7 @@ export namespace ConfigFile {
249251
authProviderConfigs,
250252
builtinAuthProvidersConfigured,
251253
chargebeeProviderOptions,
252-
stripeSettings,
254+
stripeSecrets,
253255
license,
254256
workspaceGarbageCollection: {
255257
...config.workspaceGarbageCollection,

install/installer/pkg/components/server/configmap.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
218218
VSXRegistryUrl: fmt.Sprintf("https://open-vsx.%s", ctx.Config.Domain), // todo(sje): or "https://{{ .Values.vsxRegistry.host | default "open-vsx.org" }}" if not using OpenVSX proxy
219219
EnablePayment: chargebeeSecret != "" || stripeSecret != "",
220220
ChargebeeProviderOptionsFile: fmt.Sprintf("%s/providerOptions", chargebeeMountPath),
221-
StripeSettingsFile: fmt.Sprintf("%s/apikeys", stripeMountPath),
221+
StripeSecretsFile: fmt.Sprintf("%s/apikeys", stripeMountPath),
222222
InsecureNoDomain: false,
223223
PrebuildLimiter: map[string]int{
224224
// default limit for all cloneURLs

install/installer/pkg/components/server/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ type ConfigSerialized struct {
3333
VSXRegistryUrl string `json:"vsxRegistryUrl"`
3434
ChargebeeProviderOptionsFile string `json:"chargebeeProviderOptionsFile"`
3535
StripeSettingsFile string `json:"stripeSettingsFile"`
36+
StripeSecretsFile string `json:"stripeSecretsFile"`
3637
EnablePayment bool `json:"enablePayment"`
3738

3839
WorkspaceHeartbeat WorkspaceHeartbeat `json:"workspaceHeartbeat"`

0 commit comments

Comments
 (0)