Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BC-7028 add description to allowed api keys #4889

Merged
merged 5 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 4 additions & 3 deletions apps/server/src/modules/server/server.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ export enum NodeEnvType {
MIGRATION = 'migration',
}

// Envirement keys should be added over configs from modules, directly adding is only allow for legacy stuff
// Maye some of them must be outsource to additional microservice config endpoints.
// Environment keys should be added over configs from modules, directly adding is only allow for legacy stuff
// Maye some of them must be outsourced to additional microservice config endpoints.
export interface ServerConfig
extends CoreModuleConfig,
UserConfig,
Expand Down Expand Up @@ -168,9 +168,10 @@ const config: ServerConfig = {
FEATURE_IDENTITY_MANAGEMENT_LOGIN_ENABLED: Configuration.get('FEATURE_IDENTITY_MANAGEMENT_LOGIN_ENABLED') as boolean,
STUDENT_TEAM_CREATION: Configuration.get('STUDENT_TEAM_CREATION') as string,
SYNCHRONIZATION_CHUNK: Configuration.get('SYNCHRONIZATION_CHUNK') as number,
// parse [<description>:]<token>,[<description>:]<token>... and discard description
ADMIN_API__ALLOWED_API_KEYS: (Configuration.get('ADMIN_API__ALLOWED_API_KEYS') as string)
.split(',')
.map((apiKey) => apiKey.trim()),
.map((part) => (part.split(':').pop() ?? '').trim()),
Loki-Afro marked this conversation as resolved.
Show resolved Hide resolved
BLOCKLIST_OF_EMAIL_DOMAINS: (Configuration.get('BLOCKLIST_OF_EMAIL_DOMAINS') as string)
.split(',')
.map((domain) => domain.trim()),
Expand Down
2 changes: 1 addition & 1 deletion config/default.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1344,7 +1344,7 @@
},
"ALLOWED_API_KEYS": {
"type": "string",
"description": "Allowed Admin API keys (for accessing the Admin API)."
"description": "Allowed Admin API keys (for accessing the Admin API). - A comma seperated list of strings where description is optional e.g. [<description>:]<token>,[<description>:]<token>"
}
},
"default": {
Expand Down
2 changes: 1 addition & 1 deletion config/test.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"CLIENT_ID": "schulcloud",
"CLIENT_SECRET": "secret"
},
"ADMIN_API": { "ALLOWED_API_KEYS": "thisistheadminapitokeninthetestconfig" },
"ADMIN_API": { "ALLOWED_API_KEYS": "onlyusedintests:thisistheadminapitokeninthetestconfig,someotherkey" },
"EXIT_ON_ERROR": false,
"TEACHER_STUDENT_VISIBILITY": {
"IS_CONFIGURABLE": false,
Expand Down
Loading