Skip to content

Commit 30f98c9

Browse files
author
Simon Emms
committed
[server]: add replicated as a license type
1 parent 3ffedc1 commit 30f98c9

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

components/server/src/config.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ export interface WorkspaceGarbageCollection {
4141
contentChunkLimit: number;
4242
}
4343

44+
enum LicenseType {
45+
Legacy = 'legacy',
46+
Replicated = 'replicated',
47+
}
48+
4449
/**
4550
* This is the config shape as found in the configuration file, e.g. server-configmap.yaml
4651
*/
@@ -57,6 +62,9 @@ export interface ConfigSerialized {
5762
license?: string;
5863
licenseFile?: string;
5964

65+
licenseType?: LicenseType;
66+
LicenseTypeFile?: string; // Value written to file
67+
6068
workspaceHeartbeat: {
6169
intervalSeconds: number;
6270
timeoutSeconds: number,
@@ -195,6 +203,18 @@ export namespace ConfigFile {
195203
if (licenseFile) {
196204
license = fs.readFileSync(filePathTelepresenceAware(licenseFile), "utf-8");
197205
}
206+
let licenseType = config.licenseType;
207+
const licenseTypeFile = config.LicenseTypeFile;
208+
if (licenseTypeFile) {
209+
// Default to legacy
210+
licenseType = LicenseType.Legacy;
211+
212+
const licenseTypeFileData = fs.readFileSync(filePathTelepresenceAware(licenseTypeFile), "utf-8") as LicenseType;
213+
if (Object.values(LicenseType).includes(licenseTypeFileData)) {
214+
// Valid licensor type
215+
licenseType = licenseTypeFileData;
216+
}
217+
}
198218
return {
199219
...config,
200220
stage: translateLegacyStagename(config.stage),
@@ -203,6 +223,7 @@ export namespace ConfigFile {
203223
builtinAuthProvidersConfigured,
204224
chargebeeProviderOptions,
205225
license,
226+
licenseType,
206227
workspaceGarbageCollection: {
207228
...config.workspaceGarbageCollection,
208229
startDate: config.workspaceGarbageCollection.startDate ? new Date(config.workspaceGarbageCollection.startDate).getTime() : Date.now(),

0 commit comments

Comments
 (0)