Skip to content

Commit

Permalink
create a new route: GET /admin/config. add data about currently runni…
Browse files Browse the repository at this point in the history
…ng build
  • Loading branch information
sdumetz committed Oct 18, 2024
1 parent c7b0141 commit 0953b9c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
16 changes: 12 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@

ARG PORT
ARG PUBLIC
ARG BUILD_REF

###################
# Build source
###################
FROM node:16-alpine as build
RUN mkdir -p /app/dist /app/source
WORKDIR /app
Expand Down Expand Up @@ -31,14 +38,15 @@ RUN npm run build-ui
# The actual container to be published
###################
FROM node:16-alpine
LABEL org.opencontainers.image.source=https://github.com/Holusion/e-thesaurus
LABEL org.opencontainers.image.source=https://github.com/Holusion/eCorpus
LABEL org.opencontainers.image.description="eCorpus base image"
LABEL org.opencontainers.image.licenses=Apache

ARG PORT=8000

ENV PUBLIC=false
ENV PORT=${PORT}
ENV PUBLIC=${PUBLIC:-false}
ENV PORT=${PORT:-8000}
ENV BUILD_REF=${BUILD_REF:-unknown}

ENV NODE_ENV=production

WORKDIR /app
Expand Down
2 changes: 2 additions & 0 deletions source/server/routes/admin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { isAdministrator } from "../../utils/locals.js";
import wrap from "../../utils/wrapAsync.js";
import handleGetStats from "./stats/index.js";
import handleMailtest from "./mailtest.js";
import handleGetConfig from "./config/get.js";


const router = Router();
Expand All @@ -21,6 +22,7 @@ router.use((req, res, next)=>{


router.get("/stats", isAdministrator, wrap(handleGetStats));
router.get("/config", isAdministrator, wrap(handleGetConfig));
router.post("/mailtest", isAdministrator, wrap(handleMailtest));

export default router;
1 change: 1 addition & 0 deletions source/server/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const values = {
hot_reload:[false, toBool],
smart_host: ["smtp://localhost", toString],
verbose: [false, toBool],
build_ref: ["unknown", toString],

experimental: [false, toBool],
/// FEATURE FLAGS ///
Expand Down

0 comments on commit 0953b9c

Please sign in to comment.