Skip to content

Commit

Permalink
feat(ui-env-config): minor improvements on environment config.
Browse files Browse the repository at this point in the history
  • Loading branch information
gpazuch committed Aug 5, 2021
1 parent 1e574a9 commit 7ddade5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ui/src/environments/environment.defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const environment = {
mqttWsUrl: window['env']['mqttWsUrl'] || 'ws://localhost/mqtt',
exportConfigFile: '/configs/export/config.toml',
// expose ORB routes and api versioning
orbApi: ORB.orbApi,
orbApi: {urlKeys: Object.keys(ORB.servicesUrls), ...ORB.orbApi},
...ORB.servicesUrls,
}
;
6 changes: 2 additions & 4 deletions ui/src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { environment as defaultEnvironment } from './environment.defaults';

const {sinksUrl, agentsUrl, agentGroupsUrl, orbApi: {apiUrl, version}} = defaultEnvironment;
const {orbApi: {apiUrl, version, urlKeys}} = defaultEnvironment;

export const environment = {
production: true,

...defaultEnvironment,
// ORB api --prod
// override all urls prepend /api/v<#>/<service_url>
sinksUrl: `${apiUrl}${version}${sinksUrl}`,
agentsUrl: `${apiUrl}${version}${agentsUrl}`,
agentGroupsUrl: `${apiUrl}${version}${agentGroupsUrl}`,
...urlKeys.map(key => ({[key]: `${apiUrl}${version}${defaultEnvironment[key]}`})),
};

0 comments on commit 7ddade5

Please sign in to comment.