feat: custom domain port (#3635)

This commit is contained in:
Archer
2023-08-04 13:23:21 +08:00
committed by GitHub
parent 65846957f6
commit c4baed2f6d
7 changed files with 13 additions and 4 deletions
@@ -1,3 +1,4 @@
NEXT_PUBLIC_MOCK_USER=
SEALOS_DOMAIN="cloud.sealos.io"
DOMAIN_PORT=
FASTGPT_KEY=
@@ -45,6 +45,7 @@ spec:
- env:
- name: SEALOS_DOMAIN
value: {{ .cloudDomain }}
- name: DOMAIN_PORT
- name: INGRESS_SECRET
value: {{ .ingressSecret }}
- name: FASTGPT_KEY
@@ -77,7 +77,7 @@ const App = ({ Component, pageProps }: AppProps) => {
NProgress.done();
return response;
}, [getUserSourcePrice, openConfirm]);
}, [getUserSourcePrice, initFormSliderList, openConfirm]);
// add resize event
useEffect(() => {
@@ -6,6 +6,7 @@ import { noGpuSliderKey } from '@/constants/app';
export type Response = {
SEALOS_DOMAIN: string;
DOMAIN_PORT: string;
INGRESS_SECRET: string;
SHOW_EVENT_ANALYZE: boolean;
FORM_SLIDER_LIST_CONFIG: FormSliderListType;
@@ -40,6 +41,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
jsonRes<Response>(res, {
data: {
SEALOS_DOMAIN: process.env.SEALOS_DOMAIN || 'cloud.sealos.io',
DOMAIN_PORT: process.env.DOMAIN_PORT || '',
INGRESS_SECRET: process.env.INGRESS_SECRET || 'wildcard-cert',
SHOW_EVENT_ANALYZE: !!process.env.FASTGPT_KEY,
FORM_SLIDER_LIST_CONFIG: global.FormSliderListConfig
@@ -5,7 +5,7 @@ import PodLineChart from '@/components/PodLineChart';
import { printMemory, useCopyData } from '@/utils/tools';
import dayjs from 'dayjs';
import { getUserNamespace } from '@/utils/user';
import { SEALOS_DOMAIN } from '@/store/static';
import { SEALOS_DOMAIN, DOMAIN_PORT } from '@/store/static';
import MyIcon from '@/components/Icon';
import { MOCK_APP_DETAIL } from '@/mock/apps';
import { useTranslation } from 'next-i18next';
@@ -21,7 +21,8 @@ const AppMainInfo = ({ app = MOCK_APP_DETAIL }: { app: AppDetailType }) => {
() =>
app.accessExternal.use
? `https://${
app.accessExternal.selfDomain || `${app.accessExternal.outDomain}.${SEALOS_DOMAIN}`
app.accessExternal.selfDomain ||
`${app.accessExternal.outDomain}.${SEALOS_DOMAIN}${DOMAIN_PORT}`
}`
: '',
[app]
@@ -26,7 +26,7 @@ import type { QueryType } from '@/types';
import type { AppEditType } from '@/types/app';
import { customAlphabet } from 'nanoid';
import { GpuAmountMarkList } from '@/constants/editApp';
import { SEALOS_DOMAIN } from '@/store/static';
import { DOMAIN_PORT, SEALOS_DOMAIN } from '@/store/static';
import { useTranslation } from 'next-i18next';
import { useGlobalStore } from '@/store/global';
@@ -785,6 +785,7 @@ const Form = ({
</Label>
<Box userSelect={'all'} h={'34px'} lineHeight={'34px'}>
{getValues('accessExternal.outDomain')}.{SEALOS_DOMAIN}
{DOMAIN_PORT}
</Box>
</Box>
</Flex>
@@ -1,6 +1,7 @@
import { getInitData } from '@/api/platform';
export let SEALOS_DOMAIN = 'cloud.sealos.io';
export let DOMAIN_PORT = '';
export let INGRESS_SECRET = 'wildcard-cert';
export let SHOW_EVENT_ANALYZE = false;
@@ -8,11 +9,13 @@ export const loadInitData = async () => {
try {
const res = await getInitData();
SEALOS_DOMAIN = res.SEALOS_DOMAIN;
DOMAIN_PORT = res.DOMAIN_PORT;
INGRESS_SECRET = res.INGRESS_SECRET;
SHOW_EVENT_ANALYZE = res.SHOW_EVENT_ANALYZE;
return {
SEALOS_DOMAIN,
DOMAIN_PORT,
INGRESS_SECRET,
FORM_SLIDER_LIST_CONFIG: res.FORM_SLIDER_LIST_CONFIG
};