Skip to content

Commit

Permalink
feat(generators): rename config/mongo.ts & config/postgres.ts uri pro…
Browse files Browse the repository at this point in the history
…p to url
  • Loading branch information
phatpham9 committed Feb 15, 2021
1 parent c5aa6e6 commit d1b6c1d
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion generators/with-mongo/templates/src/config/mongo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const user = process.env.MONGO_USER ?? '';
const password = process.env.MONGO_PASSWORD ?? '';

const config = {
uri:
url:
user === '' || password === ''
? `mongodb://${host}:${port}/${dbName}`
: `mongodb://${user}:${password}@${host}:${port}/${dbName}`,
Expand Down
2 changes: 1 addition & 1 deletion generators/with-mongo/templates/src/db/mongo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import config from '../config/mongo';
// connect mongo
const connect = async (): Promise<void> => {
try {
await mongoose.connect(config.uri, {
await mongoose.connect(config.url, {
useUnifiedTopology: true,
useNewUrlParser: true,
promiseLibrary: Promise,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const user = process.env.POSTGRES_USER ?? '';
const password = process.env.POSTGRES_PASSWORD ?? '';

const config = {
uri:
url:
user === '' || password === ''
? `postgres://${host}:${port}/${dbName}`
: `postgres://${user}:${password}@${host}:${port}/${dbName}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import config from '../config/postgres';
// import Thing from '../components/things/model';

// create sequelize
const sequelize = new Sequelize(config.uri);
const sequelize = new Sequelize(config.url);

// connect postgres
const connect = async (): Promise<void> => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const user = process.env.POSTGRES_USER ?? '';
const password = process.env.POSTGRES_PASSWORD ?? '';

const config = {
uri:
url:
user === '' || password === ''
? `postgres://${host}:${port}/${dbName}`
: `postgres://${user}:${password}@${host}:${port}/${dbName}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const connect = async (): Promise<void> => {
try {
await createConnection({
type: 'postgres',
url: config.uri,
url: config.url,
// TODO: register models to connection
// entities: [Thing],
synchronize: true,
Expand Down

0 comments on commit d1b6c1d

Please sign in to comment.