Updated secrets held in env vars.
This commit is contained in:
parent
787e8f6a9c
commit
85e2ad8d6f
1
.env.example
Normal file
1
.env.example
Normal file
@ -0,0 +1 @@
|
|||||||
|
KEYCLOAK_CLIENT_SECRET='SECRET'
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
@ -130,3 +130,5 @@ dist
|
|||||||
.pnp.*
|
.pnp.*
|
||||||
|
|
||||||
*.DS_STORE
|
*.DS_STORE
|
||||||
|
|
||||||
|
*.env
|
||||||
|
|||||||
@ -50,8 +50,7 @@ The application uses `config.json` for configuration. Update the following secti
|
|||||||
"keycloak": {
|
"keycloak": {
|
||||||
"url": "https://your-keycloak-server",
|
"url": "https://your-keycloak-server",
|
||||||
"realm": "your-realm",
|
"realm": "your-realm",
|
||||||
"clientId": "your-client-id",
|
"clientId": "your-client-id"
|
||||||
"clientSecret": "your-client-secret"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -71,7 +70,6 @@ npm run dev
|
|||||||
npm start
|
npm start
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## API Endpoints
|
## API Endpoints
|
||||||
|
|
||||||
The service exposes WebSocket endpoints for:
|
The service exposes WebSocket endpoints for:
|
||||||
|
|||||||
@ -9,8 +9,7 @@
|
|||||||
"keycloak": {
|
"keycloak": {
|
||||||
"url": "https://auth.tombutcher.work",
|
"url": "https://auth.tombutcher.work",
|
||||||
"realm": "master",
|
"realm": "master",
|
||||||
"clientId": "farmcontrol-client",
|
"clientId": "farmcontrol-client"
|
||||||
"clientSecret": "GPyh59xctRX83yfKWb83ShK6VEwHIvLF"
|
|
||||||
},
|
},
|
||||||
"requiredRoles": []
|
"requiredRoles": []
|
||||||
},
|
},
|
||||||
@ -32,14 +31,13 @@
|
|||||||
"keycloak": {
|
"keycloak": {
|
||||||
"url": "https://auth.tombutcher.work",
|
"url": "https://auth.tombutcher.work",
|
||||||
"realm": "master",
|
"realm": "master",
|
||||||
"clientId": "farmcontrol-client",
|
"clientId": "farmcontrol-client"
|
||||||
"clientSecret": "GPyh59xctRX83yfKWb83ShK6VEwHIvLF"
|
|
||||||
},
|
},
|
||||||
"requiredRoles": []
|
"requiredRoles": []
|
||||||
},
|
},
|
||||||
"database": {
|
"database": {
|
||||||
"mongo": {
|
"mongo": {
|
||||||
"url": "mongodb://farmcontrol.tombutcher.local:27017/farmcontrol"
|
"url": "mongodb://localhost:27017/farmcontrol"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,7 +27,20 @@ export function loadConfig() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return config[NODE_ENV];
|
const envConfig = config[NODE_ENV];
|
||||||
|
|
||||||
|
// Override keycloak client secret with environment variable if available
|
||||||
|
if (process.env.KEYCLOAK_CLIENT_SECRET) {
|
||||||
|
if (!envConfig.auth) {
|
||||||
|
envConfig.auth = {};
|
||||||
|
}
|
||||||
|
if (!envConfig.auth.keycloak) {
|
||||||
|
envConfig.auth.keycloak = {};
|
||||||
|
}
|
||||||
|
envConfig.auth.keycloak.clientSecret = process.env.KEYCLOAK_CLIENT_SECRET;
|
||||||
|
}
|
||||||
|
|
||||||
|
return envConfig;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error loading config:', err);
|
console.error('Error loading config:', err);
|
||||||
throw err;
|
throw err;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user