Skip to content

Commit

Permalink
More database variables
Browse files Browse the repository at this point in the history
  • Loading branch information
mnapoli committed Dec 8, 2020
1 parent a9df600 commit 63ffb09
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/components/Database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ export class Database extends Component {

outputs() {
return {
[this.dbResourceName + 'Name']: {
Description: 'Name of the database.',
Value: this.getDbName(),
Export: {
Name: this.stackName + '-' + this.dbResourceName + '-Name',
},
},
[this.dbResourceName + 'Host']: {
Description: 'Hostname of the database.',
Value: this.fnGetAtt(this.dbResourceName, 'Endpoint.Address'),
Expand All @@ -58,6 +65,9 @@ export class Database extends Component {
envVariables() {
let variables: Record<string, any> = {};

const dbName = this.fnImportValue(this.stackName + '-' + this.dbResourceName + '-Name');
variables[this.formatEnvVariableName(this.dbResourceName + '_NAME')] = dbName;

const dbHost = this.fnImportValue(this.stackName + '-' + this.dbResourceName + '-Host');
variables[this.formatEnvVariableName(this.dbResourceName + '_HOST')] = dbHost;

Expand Down

0 comments on commit 63ffb09

Please sign in to comment.