diff --git a/README.md b/README.md index 4ca75b9..1c14ada 100644 --- a/README.md +++ b/README.md @@ -18,4 +18,7 @@ Required: Optional: - ORMCONFIG: the ormconfig.json path, default is current project root - APPCONFIG: the config.yml path, default is current project root -- AMQP_URL: if you provide this url, it will override the amqp config in the APPCONFIG file. \ No newline at end of file +- AMQP_URL: if you provide this url, it will override the amqp config in the APPCONFIG file. + +## Configuration file + diff --git a/config.yml b/config.yml index c556236..23529da 100644 --- a/config.yml +++ b/config.yml @@ -6,6 +6,9 @@ amqp: user: "guest" password: "guest" +# amqp url has higher priority than amqp config object +amqpUrl: '' + # AppId Host Map is a mapping that used for JobExecutor or JobScheduler to replace the access url from the message # the remote url will be replaced with host defined in the mapping. there is no default value, if appid is not found, # no replacement will occur. diff --git a/package.json b/package.json index b4bdacf..caffc58 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mira-video-manager", - "version": "0.1.1", + "version": "0.2.0", "description": "Video Process for mira project", "main": "index.js", "scripts": { diff --git a/src/utils/ConfigManagerImpl.ts b/src/utils/ConfigManagerImpl.ts index 046e4d6..f6a3229 100644 --- a/src/utils/ConfigManagerImpl.ts +++ b/src/utils/ConfigManagerImpl.ts @@ -1,5 +1,5 @@ /* - * Copyright 2021 IROHA LAB + * Copyright 2022 IROHA LAB * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,6 +49,7 @@ type AppConfg = { user: string; password: string; } + amqpUrl: string; appIdHostMap: { [appId: string]: string}; jobExecProfileDir: string; videoTempDir: string; @@ -84,7 +85,11 @@ export class ConfigManagerImpl implements ConfigManager { } public amqpServerUrl(): string { - return process.env.AMQP_URL; + let amqpUrl = process.env.AMQP_URL; + if (!amqpUrl) { + amqpUrl = this._config.amqpUrl; + } + return amqpUrl; } public amqpConfig(): Options.Connect {