Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

920 B
Raw Blame
import { getInstanceSettings } from "../instance-settings/get-instance-settings";
import { apiRouter, createRoute, jsonResponse } from "../openapi";
import getSettings from "../utils/get-settings";
import { configSchema } from "./response";

// Mounted before the app-wide authenticateApiRequest middleware: the login
// screen reads it to decide which sign-in methods to render.
const getConfigRoute = createRoute({
  method: "get",
  operationId: "getConfig",
  path: "/",
  tags: ["Config"],
  summary: "Get config",
  description:
    "Public instance settings: the instance name, which sign-in methods, registration paths, integrations, and features are enabled.",
  security: [],
  responses: {
    200: jsonResponse("Application settings", configSchema),
  },
});

const config = apiRouter().openapi(getConfigRoute, async (c) =>
  c.json(getSettings(await getInstanceSettings()), 200),
);

export default config;