forked from clerk/javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.ts
More file actions
16 lines (14 loc) · 657 Bytes
/
Copy pathutils.ts
File metadata and controls
16 lines (14 loc) · 657 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { appConfigs } from '../../presets';
export const getEnvForMultiAppInstance = (envKey: string) => {
return appConfigs.envs.base
.clone()
.setEnvVariable('private', 'CLERK_SECRET_KEY', appConfigs.secrets.instanceKeys.get(envKey).sk)
.setEnvVariable('public', 'CLERK_PUBLISHABLE_KEY', appConfigs.secrets.instanceKeys.get(envKey).pk);
};
export const prepareApplication = async (envKey: string, port?: number) => {
const app = await appConfigs.next.appRouter.clone().commit();
await app.setup();
await app.withEnv(getEnvForMultiAppInstance(envKey));
const { serverUrl } = await app.dev({ port });
return { app, serverUrl };
};