Skip to content

Commit

Permalink
feat(config): adding some additional logging
Browse files Browse the repository at this point in the history
  • Loading branch information
goldcaddy77 committed Sep 20, 2021
1 parent d6dd376 commit 30ba9c4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
20 changes: 17 additions & 3 deletions src/core/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,11 @@ export class Config {
}

public getApiBaseUrl() {
const apiBaseUrl = this.get('API_BASE_URL');
// Prefer the new API_BASE_URL variable
if (this.get('API_BASE_URL')) {
return this.get('API_BASE_URL');
if (apiBaseUrl) {
debug(`Found API_BASE_URL: ${apiBaseUrl}`);
return apiBaseUrl;
}

// Continue to support passing variables as pieces (from v1 and v2)
Expand All @@ -274,7 +276,19 @@ export class Config {
}

public getApiPort() {
return new URL('', this.getApiBaseUrl()).port;
const port = new URL('', this.getApiBaseUrl()).port;
if (port) {
debug(`Found port from getApiBaseUrl: ${port}`);
return port;
} else if (this.get('APP_PORT')) {
debug(`Found port from get APP_PORT: ${this.get('APP_PORT')}`);
return this.get('APP_PORT');
} else {
debug(`Using default port for NODE_ENV: ${this.NODE_ENV}`);
return this.NODE_ENV === 'development' ? '80' : '443';
}

return;
}

public get(key?: string) {
Expand Down
2 changes: 1 addition & 1 deletion src/test/modules/kitchen-sink/kitchen-sink.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class KitchenSink extends BaseModel {
@FloatField()
floatField?: number;

@StringField({ computed: true, default: 'computed' })
@StringField({ computed: true, default: 'computedc' })
computedColumn?: string;

@JSONField({ nullable: true })
Expand Down

0 comments on commit 30ba9c4

Please sign in to comment.