Skip to content

Commit

Permalink
Merge pull request #6 from thiagopereiramartinez/master
Browse files Browse the repository at this point in the history
Atualização das configurações
  • Loading branch information
pedrobarbiero committed Jan 17, 2020
2 parents 5daf3c3 + e9a03c5 commit 4537128
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
1 change: 1 addition & 0 deletions functions/config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"projectId": "carona-prime",
"sql": {
"host": "34.68.132.157",
"user": "root",
"password": "CaronaPrime2020",
"database": "caronaprime",
Expand Down
24 changes: 18 additions & 6 deletions functions/lib/db/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,24 @@ if (!(config &&
throw "SQL Error: SQL configuration is not available. Please, enter the settings in config.json file."
}

const mysqlConfig = {
connectionLimit: 1,
user: config.sql.user,
password: config.sql.password,
database: config.sql.database,
socketPath: config.sql.socketPath
var mysqlConfig = null;

if (process.env.GCLOUD_PROJECT !== undefined) {
mysqlConfig = {
connectionLimit: 1,
user: config.sql.user,
password: config.sql.password,
database: config.sql.database,
socketPath: config.sql.socketPath
}
} else {
mysqlConfig = {
host: config.sql.host,
connectionLimit: 1,
user: config.sql.user,
password: config.sql.password,
database: config.sql.database
}
}

// Módulo
Expand Down

0 comments on commit 4537128

Please sign in to comment.