Skip to content

Commit

Permalink
fix:license add CUSTOM_BASE_PATH env (#4654)
Browse files Browse the repository at this point in the history
Signed-off-by: jingyang <3161362058@qq.com>
  • Loading branch information
zjy365 committed Apr 2, 2024
1 parent 6569cc7 commit 6c596ec
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
1 change: 1 addition & 0 deletions service/license/.env
@@ -0,0 +1 @@
CUSTOM_BASE_PATH="https://raw.githubusercontent.com/labring/sealos/main/scripts/cloud/install.sh"
1 change: 1 addition & 0 deletions service/license/.env.template
@@ -1,6 +1,7 @@
PUBLIC_URL=.
NEXT_PUBLIC_SERVICE=/service/
SEALOS_CLOUD_DOMAIN="cloud.sealos.io"
CUSTOM_BASE_PATH=""

# GITHUB_CLIENT_ID=
# GITHUB_CLIENT_SECRET=
Expand Down
9 changes: 7 additions & 2 deletions service/license/src/pages/cluster/components/Tutorial.tsx
Expand Up @@ -47,7 +47,12 @@ import ConfigForm from './ConfigForm';
const TAB_QUERY_PARAM = 'tab';
const TAB_QUERY_ARR = ['tutorial', 'cluster', 'license'];

export default function Tutorial({ ossFileUrl }: { ossFileUrl: string }) {
export type TutorialProps = {
ossFileUrl: string;
customBasePatch: string;
};

export default function Tutorial({ ossFileUrl, customBasePatch }: TutorialProps) {
const { t } = useTranslation();
const { clusterDetail } = useClusterDetail();
const { copyData } = useCopyData();
Expand Down Expand Up @@ -241,7 +246,7 @@ export default function Tutorial({ ossFileUrl }: { ossFileUrl: string }) {
</AccordionButton>
<AccordionPanel py="20px" px="0px">
<ConfigForm
basePath={`curl -sfL https://mirror.ghproxy.com/https://raw.githubusercontent.com/labring/sealos/main/scripts/cloud/install.sh -o /tmp/install.sh && bash /tmp/install.sh --zh `}
basePath={`curl -sfL ${customBasePatch} -o /tmp/install.sh && bash /tmp/install.sh --zh `}
cloudVersion={ossVersion}
/>
</AccordionPanel>
Expand Down
7 changes: 4 additions & 3 deletions service/license/src/pages/cluster/index.tsx
Expand Up @@ -29,11 +29,11 @@ import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
import { useRouter } from 'next/router';
import { useEffect, useState } from 'react';
import ClusterList from './components/List';
import Tutorial from './components/Tutorial';
import Tutorial, { TutorialProps } from './components/Tutorial';

// Activation field systemId
// Cluster recharge callback clusterId
export default function MyCluster({ ossFileUrl }: { ossFileUrl: string }) {
export default function MyCluster({ ossFileUrl, customBasePatch }: TutorialProps) {
const { t } = useTranslation();
const { clusterDetail, setClusterDetail, clearClusterDetail } = useClusterDetail();
const [isLargerThanLG] = useMediaQuery(['(min-width: 992px)', '(display-mode: browser)']);
Expand Down Expand Up @@ -152,7 +152,7 @@ export default function MyCluster({ ossFileUrl }: { ossFileUrl: string }) {
<Layout>
<Flex flex={1} h={0} bg="#fefefe" position={'relative'}>
<ClusterList />
<Tutorial ossFileUrl={ossFileUrl} />
<Tutorial ossFileUrl={ossFileUrl} customBasePatch={customBasePatch} />
</Flex>
<Modal isOpen={isOpen} onClose={onClose} autoFocus={false}>
<ModalOverlay />
Expand Down Expand Up @@ -248,6 +248,7 @@ export async function getServerSideProps({ req, res, locales }: any) {
return {
props: {
ossFileUrl: process.env.OSS_FILE_URL,
customBasePatch: process.env.CUSTOM_BASE_PATH,
...(await serverSideTranslations(local, undefined, null, locales || []))
}
};
Expand Down

0 comments on commit 6c596ec

Please sign in to comment.