Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: custom domain port #3635

Merged
merged 1 commit into from Aug 4, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions frontend/providers/applaunchpad/.env.template
@@ -1,3 +1,4 @@
NEXT_PUBLIC_MOCK_USER=
SEALOS_DOMAIN="cloud.sealos.io"
DOMAIN_PORT=
FASTGPT_KEY=
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
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
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
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
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
@@ -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