refacto env config
This commit is contained in:
parent
a6d9b39a5f
commit
40831d9c0d
@ -4,6 +4,7 @@ import "@Front/index.scss";
|
||||
import type { NextPage } from "next";
|
||||
import type { AppType, AppProps } from "next/app";
|
||||
import type { ReactElement, ReactNode } from "react";
|
||||
import getConfig from 'next/config'
|
||||
|
||||
export type NextPageWithLayout<TProps = Record<string, unknown>, TInitialProps = TProps> = NextPage<TProps, TInitialProps> & {
|
||||
getLayout?: (page: ReactElement) => ReactNode;
|
||||
@ -25,6 +26,8 @@ type AppPropsWithLayout = AppProps & {
|
||||
docaposteApiUrl: string;
|
||||
};
|
||||
|
||||
const { publicRuntimeConfig } = getConfig();
|
||||
|
||||
const MyApp = (({
|
||||
Component,
|
||||
pageProps,
|
||||
@ -60,18 +63,18 @@ const MyApp = (({
|
||||
|
||||
MyApp.getInitialProps = async () => {
|
||||
return {
|
||||
backApiProtocol: process.env["NEXT_PUBLIC_BACK_API_PROTOCOL"],
|
||||
backApiHost: process.env["NEXT_PUBLIC_BACK_API_HOST"],
|
||||
backApiRootUrl: process.env["NEXT_PUBLIC_BACK_API_ROOT_URL"],
|
||||
backApiVersion: process.env["NEXT_PUBLIC_BACK_API_VERSION"],
|
||||
frontAppHost: process.env["NEXT_PUBLIC_FRONT_APP_HOST"],
|
||||
frontAppPort: process.env["NEXT_PUBLIC_FRONT_APP_PORT"],
|
||||
idNotBaseUrl: process.env["NEXT_PUBLIC_IDNOT_BASE_URL"],
|
||||
idNotAuthorizeEndpoint: process.env["NEXT_PUBLIC_IDNOT_AUTHORIZE_ENDPOINT"],
|
||||
idNotClientId: process.env["NEXT_PUBLIC_IDNOT_CLIENT_ID"],
|
||||
fcAuthorizeEndpoint: process.env["NEXT_PUBLIC_FC_AUTHORIZE_ENDPOINT"],
|
||||
fcClientId: process.env["NEXT_PUBLIC_FC_CLIENT_ID"],
|
||||
docaposteApiUrl: process.env["NEXT_PUBLIC_DOCAPOST_API_URL"],
|
||||
backApiProtocol: publicRuntimeConfig.NEXT_PUBLIC_BACK_API_PROTOCOL,
|
||||
backApiHost: publicRuntimeConfig.NEXT_PUBLIC_BACK_API_HOST,
|
||||
backApiRootUrl: publicRuntimeConfig.NEXT_PUBLIC_BACK_API_ROOT_URL,
|
||||
backApiVersion: publicRuntimeConfig.NEXT_PUBLIC_BACK_API_VERSION,
|
||||
frontAppHost: publicRuntimeConfig.NEXT_PUBLIC_FRONT_APP_HOST,
|
||||
frontAppPort: publicRuntimeConfig.NEXT_PUBLIC_FRONT_APP_PORT,
|
||||
idNotBaseUrl: publicRuntimeConfig.NEXT_PUBLIC_IDNOT_BASE_URL,
|
||||
idNotAuthorizeEndpoint: publicRuntimeConfig.NEXT_PUBLIC_IDNOT_AUTHORIZE_ENDPOINT,
|
||||
idNotClientId: publicRuntimeConfig.NEXT_PUBLIC_IDNOT_CLIENT_ID,
|
||||
fcAuthorizeEndpoint: publicRuntimeConfig.NEXT_PUBLIC_FC_AUTHORIZE_ENDPOINT,
|
||||
fcClientId: publicRuntimeConfig.NEXT_PUBLIC_FC_CLIENT_ID,
|
||||
docaposteApiUrl: publicRuntimeConfig.NEXT_PUBLIC_DOCAPOST_API_URL,
|
||||
};
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user