Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions juno.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,10 @@ export default defineConsoleConfig(({ mode }) => ({
delegation
}
}
}),
...(mode === 'development' && {
api: {
url: 'http://localhost:3000'
}
})
}));
2 changes: 2 additions & 0 deletions src/frontend/src/lib/constants/app.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ export const CYCLES_INDEX_CANISTER_ID = 'ul4oc-4iaaa-aaaaq-qaabq-cai';
export const GOOGLE_CLIENT_ID = import.meta.env.VITE_GOOGLE_CLIENT_ID;
export const GITHUB_CLIENT_ID = import.meta.env.VITE_GITHUB_CLIENT_ID;

export const JUNO_API_URL = import.meta.env.VITE_JUNO_API_URL;

/**
* Revoked principals that must not be used.
*
Expand Down
1 change: 1 addition & 0 deletions src/frontend/src/vite-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ interface ImportMetaEnv {
readonly VITE_CONSOLE_ID: string;
readonly VITE_GOOGLE_CLIENT_ID: string | undefined;
readonly VITE_GITHUB_CLIENT_ID: string | undefined;
readonly VITE_JUNO_API_URL: string | undefined;

// .env
readonly VITE_BN_REGISTRATIONS_URL: string | '' | undefined;
Expand Down
8 changes: 6 additions & 2 deletions vite.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const readConsoleConfig = async (env: JunoConfigEnv): Promise<JunoConsoleConfig>
const defineJunoEnv = async ({
mode
}: JunoConfigEnv): Promise<Omit<ViteReplacements, 'VITE_APP_VERSION'>> => {
const { id, ids, authentication } = await readConsoleConfig({ mode });
const { id, ids, authentication, api } = await readConsoleConfig({ mode });

const consoleId = id ?? ids[mode];

Expand All @@ -32,14 +32,17 @@ const defineJunoEnv = async ({
const googleClientId = authentication?.google?.clientId;
const githubClientId = authentication?.github?.clientId;

const apiUrl = api?.url;

return {
VITE_CONSOLE_ID: JSON.stringify(consoleId),
VITE_GOOGLE_CLIENT_ID: notEmptyString(googleClientId)
? JSON.stringify(googleClientId)
: undefined,
VITE_GITHUB_CLIENT_ID: notEmptyString(githubClientId)
? JSON.stringify(githubClientId)
: undefined
: undefined,
VITE_JUNO_API_URL: notEmptyString(apiUrl) ? JSON.stringify(apiUrl) : undefined
};
};

Expand All @@ -57,6 +60,7 @@ interface ViteReplacements {
VITE_CONSOLE_ID: string;
VITE_GOOGLE_CLIENT_ID: string | undefined;
VITE_GITHUB_CLIENT_ID: string | undefined;
VITE_JUNO_API_URL: string | undefined;
VITE_APP_VERSION: string;
}

Expand Down
Loading