Skip to content

Commit

Permalink
Implement query params
Browse files Browse the repository at this point in the history
  • Loading branch information
pablomendezroyo committed Nov 27, 2024
1 parent cf23ba1 commit 4cce7ce
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface Params {
/**
* Query env from a package
*/
export const envGet = wrapHandler<Params>(async (req, res) => {
export const env = wrapHandler<Params>(async (req, res) => {
const { dnpName, envName } = req.params;

if (!dnpName || !envName) {
Expand Down
2 changes: 1 addition & 1 deletion packages/dappmanager/src/api/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ export * from "./upload.js";
export * from "./downloadWireguardConfig.js";
export * from "./notificationSend.js";
export * from "./metrics.js";
export * from "./envGet.js";
export * from "./env.js";
10 changes: 3 additions & 7 deletions packages/dappmanager/src/api/startHttpApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export interface HttpRoutes {
download: RequestHandler<{ fileId: string }>;
downloadUserActionLogs: RequestHandler;
downloadWireguardConfig: RequestHandler<{ device: string }>;
envGet: RequestHandler<{ dnpName: string; envName: string }>;
env: RequestHandler<{ dnpName: string; envName: string }>;
fileDownload: RequestHandler<{ containerName: string }>;
globalEnvs: RequestHandler<{ name: string }>;
notificationSend: RequestHandler;
Expand Down Expand Up @@ -150,22 +150,18 @@ export function startHttpApi({
app.get("/ping", auth.onlyAdmin, (_, res) => res.send({}));

// ADMIN ONLY methods that do not fit into RPC
// prettier-ignore
app.get("/wireguard-config/:device", auth.onlyAdmin, routes.downloadWireguardConfig);
// prettier-ignore
app.get("/container-logs/:containerName", auth.onlyAdmin, routes.containerLogs);
app.get("/file-download/:containerName", auth.onlyAdmin, routes.fileDownload);
app.get("/env-get/:dnpName/:envName", auth.onlyAdmin, routes.envGet);
app.get("/download/:fileId", auth.onlyAdmin, routes.download);
app.get("/user-action-logs", auth.onlyAdmin, routes.downloadUserActionLogs);
app.post("/upload", auth.onlyAdmin, routes.upload);

// Open endpoints (no auth)
app.get("/global-envs/:name?", routes.globalEnvs);
// prettier-ignore
app.get("/env", routes.env);
app.get("/public-packages/:containerName?", routes.publicPackagesData);
// prettier-ignore
app.get("/package-manifest/:dnpName",routes.packageManifest);
app.get("/package-manifest/:dnpName", routes.packageManifest);
app.get("/metrics", routes.metrics);
app.post("/sign", routes.sign);
app.post("/data-send", routes.dataSend);
Expand Down

0 comments on commit 4cce7ce

Please sign in to comment.