Skip to content

Commit 4fa892d

Browse files
committed
Prototype BFF
1 parent a111d5a commit 4fa892d

File tree

20 files changed

+1731
-58
lines changed

20 files changed

+1731
-58
lines changed

frontend-config.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"backendUrl": "http://localhost:3000",
32
"gatewayUrl": "https://gateway.ui.dev-core.mcpd.shoot.canary.k8s-hana.ondemand.com/kubernetes/graphql",
43
"landscape": "LOCAL",
54
"documentationBaseUrl": "http://localhost:3000",

server/.env.template

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# OpenID Connect Configuration for Onboarding API
2+
OIDC_ISSUER=
3+
OIDC_CLIENT_ID=
4+
OIDC_SCOPES=
5+
OIDC_REDIRECT_URI=http://localhost:5173
6+
7+
POST_LOGIN_REDIRECT=http://localhost:5173
8+
9+
10+
# Location of the API Backend
11+
API_BACKEND_URL=
12+
13+
14+
# Cookie Secret
15+
# Replace this value with a strong, randomly generated string (at least 32 characters).
16+
# Example for generation in Node.js: require('crypto').randomBytes(32).toString('hex')
17+
COOKIE_SECRET=

server/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# TODO

server/app.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import path, { join, dirname } from "node:path";
2+
import { fileURLToPath } from "node:url";
3+
import AutoLoad from "@fastify/autoload";
4+
import envPlugin from "./config/env.js";
5+
6+
export const options = {};
7+
8+
const __filename = fileURLToPath(import.meta.url);
9+
const __dirname = dirname(__filename);
10+
11+
export default async function(fastify, opts) {
12+
await fastify.register(envPlugin);
13+
14+
await fastify.register(AutoLoad, {
15+
dir: join(__dirname, "plugins"),
16+
options: { ...opts },
17+
});
18+
19+
await fastify.register(AutoLoad, {
20+
dir: join(__dirname, "routes"),
21+
options: { ...opts },
22+
});
23+
}

server/config/env.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import fastifyPlugin from "fastify-plugin";
2+
import fastifyEnv from "@fastify/env";
3+
4+
const schema = {
5+
type: "object",
6+
required: ["OIDC_ISSUER", "OIDC_CLIENT_ID", "OIDC_REDIRECT_URI", "OIDC_SCOPES", "POST_LOGIN_REDIRECT", "COOKIE_SECRET", "API_BACKEND_URL"],
7+
properties: {
8+
// Application variables (.env)
9+
OIDC_ISSUER: { type: "string" },
10+
OIDC_CLIENT_ID: { type: "string" },
11+
OIDC_REDIRECT_URI: { type: "string" },
12+
OIDC_SCOPES: { type: "string" },
13+
POST_LOGIN_REDIRECT: { type: "string" },
14+
COOKIE_SECRET: { type: "string" },
15+
API_BACKEND_URL: { type: "string" },
16+
17+
// System variables
18+
NODE_ENV: { type: "string", enum: ["development", "production"] },
19+
},
20+
};
21+
22+
async function envPlugin(fastify) {
23+
await fastify.register(fastifyEnv, { schema });
24+
}
25+
26+
export default fastifyPlugin(envPlugin);

0 commit comments

Comments
 (0)