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

fix: database deletion policy #5382

Merged
merged 1 commit into from
Feb 19, 2025
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions frontend/providers/dbprovider/src/pages/api/delDBByName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
console.log(error);
}

// get backup and delete
const backups = await getBackupListByDBName({ dbName: name, req });
await Promise.all(
backups.map((item) => delBackupByName({ backupName: item.metadata.name, req }))
);
// Backup strategy has been migrated, no need to delete manually
// const backups = await getBackupListByDBName({ dbName: name, req });
// await Promise.all(
// backups.map((item) => delBackupByName({ backupName: item.metadata.name, req }))
// );

// del service
await k8sCore.deleteNamespacedService(`${name}-export`, namespace).catch((err) => {
Expand Down
3 changes: 3 additions & 0 deletions frontend/providers/template/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,13 @@ export default function AppList({

// https://nextjs.org/docs/pages/api-reference/functions/get-server-side-props#context-parameter
export async function getServerSideProps(content: any) {
const forcedLanguage = process.env.FORCED_LANGUAGE;
const brandName = process.env.NEXT_PUBLIC_BRAND_NAME;
const local =
forcedLanguage ||
content?.req?.cookies?.NEXT_LOCALE ||
compareFirstLanguages(content?.req?.headers?.['accept-language'] || 'zh');

content?.res.setHeader(
'Set-Cookie',
`NEXT_LOCALE=${local}; Max-Age=2592000; Secure; SameSite=None`
Expand Down
1 change: 1 addition & 0 deletions frontend/providers/template/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export type ServiceEnvType = {
};

export type EnvResponse = {
FORCED_LANGUAGE: string;
SEALOS_CLOUD_DOMAIN: string;
SEALOS_CERT_SECRET_NAME: string;
TEMPLATE_REPO_URL: string;
Expand Down
3 changes: 2 additions & 1 deletion frontend/providers/template/src/utils/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,8 @@ export function getTemplateEnvs(namespace?: string): EnvResponse {
SEALOS_SERVICE_ACCOUNT: namespace?.replace('ns-', '') || '',
SHOW_AUTHOR: process.env.SHOW_AUTHOR || 'false',
DESKTOP_DOMAIN: process.env.DESKTOP_DOMAIN || 'cloud.sealos.io',
CURRENCY_SYMBOL: (process.env.CURRENCY_SYMBOL as 'shellCoin' | 'cny' | 'usd') || 'shellCoin'
CURRENCY_SYMBOL: (process.env.CURRENCY_SYMBOL as 'shellCoin' | 'cny' | 'usd') || 'shellCoin',
FORCED_LANGUAGE: process.env.FORCED_LANGUAGE || 'zh-CN'
};
return TemplateEnvs;
}
Expand Down