Skip to content

Commit a62fc1b

Browse files
committed
Chapter 3 Lesson 4: Extracting the credentials to env variables
1 parent 8735d39 commit a62fc1b

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

course-02/exercises/udacity-c2-restapi/src/aws.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { config } from './config/config';
44
const c = config.dev;
55

66
//Configure AWS
7-
var credentials = new AWS.SharedIniFileCredentials({profile: 'default'});
7+
var credentials = new AWS.SharedIniFileCredentials({profile: c.aws_profile});
88
AWS.config.credentials = credentials;
99

1010
export const s3 = new AWS.S3({

course-02/exercises/udacity-c2-restapi/src/config/config.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
export const config = {
22
"dev": {
3-
"username": "",
4-
"password": "",
5-
"database": "",
6-
"host": "",
3+
"username": process.env.POSTGRES_USERNAME,
4+
"password": process.env.POSTGRES_PASSWORD,
5+
"database": process.env.POSTGRES_DATABASE,
6+
"host": process.env.POSTGRES_HOST,
77
"dialect": "postgres",
8-
"aws_region": "us-east-2",
8+
"aws_region": process.env.AWS_REGION,
99
"aws_profile": "default",
10-
"aws_media_bucket": "udagram-ruttner-dev"
10+
"aws_media_bucket": process.env.AWS_BUCKET
1111
},
1212
"prod": {
1313
"username": "",

course-02/exercises/udacity-c2-restapi/src/controllers/v0/users/routes/auth.router.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import { NextFunction } from 'connect';
88

99
import * as EmailValidator from 'email-validator';
1010

11+
import { config } from '../../../../config/config';
12+
1113
const router: Router = Router();
1214

1315
async function generatePassword(plainTextPassword: string): Promise<string> {

course-02/exercises/udacity-c2-restapi/src/sequelize.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const sequelize = new Sequelize({
1111
"database": c.database,
1212
"host": c.host,
1313

14-
dialect: 'postgres',
15-
storage: ':memory:',
14+
dialect: c.dialect,
15+
// storage: ':memory:',
1616
});
1717

0 commit comments

Comments
 (0)