This commit is contained in:
xiongxiao
2026-03-18 00:49:20 +08:00
committed by cnb
commit 819cbcebac
8 changed files with 88 additions and 0 deletions

27
src/app.ts Normal file
View File

@@ -0,0 +1,27 @@
import { App } from "@kevisual/router";
import { useContextKey } from "@kevisual/context";
import { CNB } from "@kevisual/cnb";
import { Gitea } from '@kevisual/gitea';
import path from "node:path";
export const app = useContextKey("app", () => {
const app = new App({
});
return app;
});
export const cnb = useContextKey("cnb", () => {
const token = useContextKey("CNB_API_KEY") || useContextKey('CNB_TOKEN')
return new CNB({ token });
});
export const gitea = useContextKey('gitea', () => {
const GITEA_TOKEN = useContextKey("GITEA_TOKEN")
const GITEA_URL = useContextKey("GITEA_URL")
return new Gitea({
token: GITEA_TOKEN,
baseURL: GITEA_URL,
})
})
export const rootPath = path.join(process.cwd(), "storages");