add Keycloak, add better canvas
This commit is contained in:
@@ -1,11 +1,27 @@
|
||||
import express, { type Request, Response, NextFunction } from "express";
|
||||
import { registerRoutes } from "./routes";
|
||||
import { setupVite, serveStatic, log } from "./vite";
|
||||
import { setupKeycloak } from "./keycloak";
|
||||
import { config } from "./config";
|
||||
|
||||
const app = express();
|
||||
app.use(express.json());
|
||||
app.use(express.urlencoded({ extended: false }));
|
||||
|
||||
// Keycloak Setup
|
||||
let keycloak: any = null;
|
||||
if (config.enableKeycloak) {
|
||||
// Set environment variables for Keycloak
|
||||
process.env.KEYCLOAK_REALM = config.keycloakRealm;
|
||||
process.env.KEYCLOAK_AUTH_URL = config.keycloakAuthUrl;
|
||||
process.env.KEYCLOAK_CLIENT_ID = config.keycloakClientId;
|
||||
|
||||
keycloak = setupKeycloak(app);
|
||||
log("Keycloak authentication enabled");
|
||||
} else {
|
||||
log("Keycloak authentication disabled");
|
||||
}
|
||||
|
||||
app.use((req, res, next) => {
|
||||
const start = Date.now();
|
||||
const path = req.path;
|
||||
@@ -60,7 +76,7 @@ app.use((req, res, next) => {
|
||||
// Other ports are firewalled. Default to 5000 if not specified.
|
||||
// this serves both the API and the client.
|
||||
// It is the only port that is not firewalled.
|
||||
const port = parseInt(process.env.PORT || '5000', 10);
|
||||
const port = parseInt(process.env.PORT || '5001', 10);
|
||||
server.listen({
|
||||
port,
|
||||
host: "0.0.0.0",
|
||||
|
||||
Reference in New Issue
Block a user