From 63ffb093570effca61529e8e3e76d2ff6a956174 Mon Sep 17 00:00:00 2001 From: Matthieu Napoli Date: Tue, 8 Dec 2020 22:25:28 +0100 Subject: [PATCH] More database variables --- src/components/Database.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/components/Database.ts b/src/components/Database.ts index 4f491a9e..37ee2211 100644 --- a/src/components/Database.ts +++ b/src/components/Database.ts @@ -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'), @@ -58,6 +65,9 @@ export class Database extends Component { envVariables() { let variables: Record = {}; + 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;