Skip to content

Commit

Permalink
feat: custom domain port (labring#3635)
Browse files Browse the repository at this point in the history
  • Loading branch information
c121914yu committed Aug 4, 2023
1 parent 6584695 commit c4baed2
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions frontend/providers/applaunchpad/.env.template
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
NEXT_PUBLIC_MOCK_USER=
SEALOS_DOMAIN="cloud.sealos.io"
DOMAIN_PORT=
FASTGPT_KEY=
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ spec:
- env:
- name: SEALOS_DOMAIN
value: {{ .cloudDomain }}
- name: DOMAIN_PORT
- name: INGRESS_SECRET
value: {{ .ingressSecret }}
- name: FASTGPT_KEY
Expand Down
2 changes: 1 addition & 1 deletion frontend/providers/applaunchpad/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const App = ({ Component, pageProps }: AppProps) => {
NProgress.done();

return response;
}, [getUserSourcePrice, openConfirm]);
}, [getUserSourcePrice, initFormSliderList, openConfirm]);

// add resize event
useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -785,6 +785,7 @@ const Form = ({
</Label>
<Box userSelect={'all'} h={'34px'} lineHeight={'34px'}>
{getValues('accessExternal.outDomain')}.{SEALOS_DOMAIN}
{DOMAIN_PORT}
</Box>
</Box>
</Flex>
Expand Down
3 changes: 3 additions & 0 deletions frontend/providers/applaunchpad/src/store/static.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
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;

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
};
Expand Down

0 comments on commit c4baed2

Please sign in to comment.