@@ -20,12 +20,18 @@ import { filePathTelepresenceAware } from "@gitpod/gitpod-protocol/lib/env";
20
20
export const Config = Symbol ( "Config" ) ;
21
21
export type Config = Omit <
22
22
ConfigSerialized ,
23
- "blockedRepositories" | "hostUrl" | "chargebeeProviderOptionsFile" | "stripeSecretsFile" | "licenseFile"
23
+ | "blockedRepositories"
24
+ | "hostUrl"
25
+ | "chargebeeProviderOptionsFile"
26
+ | "stripeSecretsFile"
27
+ | "stripeConfigFile"
28
+ | "licenseFile"
24
29
> & {
25
30
hostUrl : GitpodHostUrl ;
26
31
workspaceDefaults : WorkspaceDefaults ;
27
32
chargebeeProviderOptions ?: ChargebeeProviderOptions ;
28
33
stripeSecrets ?: { publishableKey : string ; secretKey : string } ;
34
+ stripeConfig ?: { usageProductPriceIds : { EUR : string ; USD : string } } ;
29
35
builtinAuthProvidersConfigured : boolean ;
30
36
blockedRepositories : { urlRegExp : RegExp ; blockUser : boolean } [ ] ;
31
37
inactivityPeriodForRepos ?: number ;
@@ -152,6 +158,7 @@ export interface ConfigSerialized {
152
158
*/
153
159
chargebeeProviderOptionsFile ?: string ;
154
160
stripeSecretsFile ?: string ;
161
+ stripeConfigFile ?: string ;
155
162
enablePayment ?: boolean ;
156
163
157
164
/**
@@ -222,7 +229,15 @@ export namespace ConfigFile {
222
229
fs . readFileSync ( filePathTelepresenceAware ( config . stripeSecretsFile ) , "utf-8" ) ,
223
230
) ;
224
231
} catch ( error ) {
225
- console . error ( "Could not load Stripe secrets" , error ) ;
232
+ log . error ( "Could not load Stripe secrets" , error ) ;
233
+ }
234
+ }
235
+ let stripeConfig : { usageProductPriceIds : { EUR : string ; USD : string } } | undefined ;
236
+ if ( config . enablePayment && config . stripeConfigFile ) {
237
+ try {
238
+ stripeConfig = JSON . parse ( fs . readFileSync ( filePathTelepresenceAware ( config . stripeConfigFile ) , "utf-8" ) ) ;
239
+ } catch ( error ) {
240
+ log . error ( "Could not load Stripe config" , error ) ;
226
241
}
227
242
}
228
243
let license = config . license ;
@@ -252,6 +267,7 @@ export namespace ConfigFile {
252
267
builtinAuthProvidersConfigured,
253
268
chargebeeProviderOptions,
254
269
stripeSecrets,
270
+ stripeConfig,
255
271
license,
256
272
workspaceGarbageCollection : {
257
273
...config . workspaceGarbageCollection ,
0 commit comments