Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 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
2 changes: 2 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# OpenID Connect Configuration for Onboarding API
OIDC_ISSUER=
OIDC_CLIENT_ID=
OIDC_CLIENT_ID_MCP=
OIDC_SCOPES=
OIDC_REDIRECT_URI=http://localhost:5173

Expand All @@ -15,6 +16,7 @@ API_BACKEND_URL=
# Replace this value with a strong, randomly generated string (at least 32 characters).
# Example for generation in Node.js: require('crypto').randomBytes(32).toString('hex')
COOKIE_SECRET=
SESSION_SECRET=

FEEDBACK_SLACK_URL=
FEEDBACK_URL_LINK=
27 changes: 24 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
"@fastify/cookie": "^11.0.2",
"@fastify/env": "^5.0.2",
"@fastify/http-proxy": "^11.1.2",
"@fastify/secure-session": "^8.2.0",
"@fastify/sensible": "^6.0.3",
"@fastify/secure-session": "^8.2.0",
"@fastify/session": "^11.1.0",
"@fastify/static": "^8.1.1",
"@fastify/vite": "^8.1.3",
"@hookform/resolvers": "^5.0.0",
Expand Down Expand Up @@ -83,4 +84,4 @@
"vite": "^6.3.4",
"vitest": "^3.1.4"
}
}
}
3 changes: 0 additions & 3 deletions public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,6 @@
},
"learnButton": "Learn how to do this in code"
},
"App": {
"loading": "Loading..."
},
"Providers": {
"headerProviders": "Providers",
"tableHeaderVersion": "Version",
Expand Down
10 changes: 8 additions & 2 deletions server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@ import path, { join, dirname } from "node:path";
import { fileURLToPath } from "node:url";
import AutoLoad from "@fastify/autoload";
import envPlugin from "./config/env.js";
import encryptedSession from "./encrypted-session.js";

export const options = {};

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

export default async function(fastify, opts) {
export default async function (fastify, opts) {
await fastify.register(envPlugin);
fastify.register(encryptedSession, {
...opts,
});

await fastify.register(AutoLoad, {
dir: join(__dirname, "plugins"),
Expand All @@ -20,4 +24,6 @@ export default async function(fastify, opts) {
dir: join(__dirname, "routes"),
options: { ...opts },
});
}


}
40 changes: 26 additions & 14 deletions server/config/env.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,35 @@
import fastifyPlugin from "fastify-plugin";
import fastifyEnv from "@fastify/env";
import fastifyPlugin from 'fastify-plugin';
import fastifyEnv from '@fastify/env';

const schema = {
type: "object",
required: ["OIDC_ISSUER", "OIDC_CLIENT_ID", "OIDC_REDIRECT_URI", "OIDC_SCOPES", "POST_LOGIN_REDIRECT", "COOKIE_SECRET", "API_BACKEND_URL"],
type: 'object',
required: [
'OIDC_ISSUER',
'OIDC_CLIENT_ID',
'OIDC_CLIENT_ID_MCP',
'OIDC_REDIRECT_URI',
'OIDC_SCOPES',
'POST_LOGIN_REDIRECT',
'COOKIE_SECRET',
'SESSION_SECRET',
'API_BACKEND_URL',
],
properties: {
// Application variables (.env)
OIDC_ISSUER: { type: "string" },
OIDC_CLIENT_ID: { type: "string" },
OIDC_REDIRECT_URI: { type: "string" },
OIDC_SCOPES: { type: "string" },
POST_LOGIN_REDIRECT: { type: "string" },
COOKIE_SECRET: { type: "string" },
API_BACKEND_URL: { type: "string" },
FEEDBACK_SLACK_URL: { type: "string" },
FEEDBACK_URL_LINK: { type: "string" },
OIDC_ISSUER: { type: 'string' },
OIDC_CLIENT_ID: { type: 'string' },
OIDC_CLIENT_ID_MCP: { type: 'string' },
OIDC_REDIRECT_URI: { type: 'string' },
OIDC_SCOPES: { type: 'string' },
POST_LOGIN_REDIRECT: { type: 'string' },
COOKIE_SECRET: { type: 'string' },
SESSION_SECRET: { type: 'string' },
Comment on lines +25 to +26
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential improvement in the future: Add validation to ensure these values cannot be empty (e.g. minLength = 16).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, I moved it into the follow-up task: openmcp-project/backlog#162

API_BACKEND_URL: { type: 'string' },
FEEDBACK_SLACK_URL: { type: 'string' },
FEEDBACK_URL_LINK: { type: 'string' },

// System variables
NODE_ENV: { type: "string", enum: ["development", "production"] },
NODE_ENV: { type: 'string', enum: ['development', 'production'] },
},
};

Expand Down
Loading
Loading