Skip to content

Commit

Permalink
feat: allow configuring master image repository & branch via env
Browse files Browse the repository at this point in the history
  • Loading branch information
tada5hi committed Jul 17, 2024
1 parent 4c849ab commit 24043d3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion packages/server-core/src/config/env/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ export enum ConfigDefaults {
REDIS = 'redis://127.0.0.1',
RABBITMQ = 'amqp://root:[email protected]',
VAULT = 'start123@http://127.0.0.1:8090/v1/',
MASTER_IMAGE = 'https://github.com/PHT-Medic/master-images/',
MASTER_IMAGE_URL = 'https://github.com/PrivateAim/master-images/',
MASTER_IMAGE_BRANCH = 'master',
}
3 changes: 2 additions & 1 deletion packages/server-core/src/config/env/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ export function useEnv(key?: string) : any {
authupApiURL: read('AUTHUP_URL'),
appURL: read('APP_URL', 'http://127.0.0.1:3000/'),

masterImagesURL: read('MASTER_IMAGE_URL', ConfigDefaults.MASTER_IMAGE),
masterImagesURL: read('MASTER_IMAGE_URL', ConfigDefaults.MASTER_IMAGE_URL),
masterImagesBranch: read('MASTER_IMAGE_BRANCH', ConfigDefaults.MASTER_IMAGE_BRANCH),

skipProjectApproval: readBool('SKIP_PROJECT_APPROVAL'),
skipAnalysisApproval: readBool('SKIP_ANALYSIS_APPROVAL'),
Expand Down
1 change: 1 addition & 0 deletions packages/server-core/src/config/env/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export interface Environment {
appURL: string,

masterImagesURL: string,
masterImagesBranch: string,

skipProjectApproval: boolean,
skipAnalysisApproval: boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import { MasterImagesCommand, buildMasterImagesTaskQueueRouterPayload } from '@privateaim/server-analysis-manager-kit';
import { isQueueRouterUsable, useLogger, useQueueRouter } from '@privateaim/server-kit';
import { useEnv } from '../../../config';

export async function runMasterImagesSynchronizeCommand() : Promise<void> {
if (!isQueueRouterUsable()) {
Expand All @@ -17,8 +18,8 @@ export async function runMasterImagesSynchronizeCommand() : Promise<void> {
const message = buildMasterImagesTaskQueueRouterPayload({
command: MasterImagesCommand.SYNCHRONIZE,
data: {
branch: 'master', // todo: extract from request
url: 'https://github.com/PrivateAim/master-images/', // todo: extract from request
branch: useEnv('masterImagesBranch'),
url: useEnv('masterImagesURL'),
},
});

Expand Down

0 comments on commit 24043d3

Please sign in to comment.