Skip to content

Commit

Permalink
add amqpUrl to config. it has a higher priority than amqp config dict…
Browse files Browse the repository at this point in the history
…. bump version to 0.2.0
  • Loading branch information
EverettSummer committed Jan 8, 2022
1 parent 2f4e78b commit a4b64cb
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
- AMQP_URL: if you provide this url, it will override the amqp config in the APPCONFIG file.

## Configuration file

3 changes: 3 additions & 0 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
9 changes: 7 additions & 2 deletions src/utils/ConfigManagerImpl.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -49,6 +49,7 @@ type AppConfg = {
user: string;
password: string;
}
amqpUrl: string;
appIdHostMap: { [appId: string]: string};
jobExecProfileDir: string;
videoTempDir: string;
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit a4b64cb

Please sign in to comment.