MCPcopy Create free account
hub / github.com/bewcloud/bewcloud / loadConfig

Method loadConfig

lib/config.ts:57–115  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

55 }
56
57 private static async loadConfig(): Promise<void> {
58 if (this.config) {
59 return;
60 }
61
62 const initialConfig = this.getDefaultConfig();
63
64 const config: Config = {
65 ...initialConfig,
66 };
67
68 try {
69 const configFromFile: Config = (await import(toFileUrl(join(Deno.cwd(), 'bewcloud.config.ts')).href)).default;
70
71 this.config = {
72 ...config,
73 auth: {
74 ...config.auth,
75 ...configFromFile.auth,
76 },
77 files: {
78 ...config.files,
79 ...configFromFile.files,
80 },
81 core: {
82 ...config.core,
83 ...configFromFile.core,
84 },
85 visuals: {
86 ...config.visuals,
87 ...configFromFile.visuals,
88 },
89 email: {
90 ...config.email,
91 ...configFromFile.email,
92 },
93 contacts: {
94 ...config.contacts,
95 ...configFromFile.contacts,
96 },
97 calendar: {
98 ...config.calendar,
99 ...configFromFile.calendar,
100 },
101 };
102
103 console.info('\nConfig loaded from bewcloud.config.ts', JSON.stringify(this.config, null, 2), '\n');
104
105 if (this.config.core.enabledApps.length === 0) {
106 throw new Error('At least one app must be enabled. Please check the config.core.enabledApps array.');
107 }
108
109 return;
110 } catch (error) {
111 console.error('Error loading config from bewcloud.config.ts. Using default config instead.', error);
112 }
113
114 this.config = config;

Callers 15

getConfigMethod · 0.95
isSignupAllowedMethod · 0.95
isAppEnabledMethod · 0.95
isCookieDomainAllowedMethod · 0.95
isSingleSignOnEnabledMethod · 0.95
getFilesRootPathMethod · 0.95

Calls 1

getDefaultConfigMethod · 0.95

Tested by

no test coverage detected