Skip to content

Commit 3b5e93b

Browse files
committed
fix(postgres): Fix postgresql url
1 parent a26e98b commit 3b5e93b

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

src/core/mongo/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ export class MongoPlugin implements DepkerPlugin {
221221

222222
const database = name;
223223
const username = name;
224-
const password = generator.generate();
224+
const password = generator.generate(20, true, true, false);
225225

226226
await this.exec(`
227227
use ${database};
@@ -354,7 +354,7 @@ export class MongoPlugin implements DepkerPlugin {
354354
const config = await this.depker.config.service<MongoServiceConfig>(MongoPlugin.NAME);
355355
if (!config.username || !config.password) {
356356
config.username = "root";
357-
config.password = generator.generate();
357+
config.password = generator.generate(20, true, true, false);
358358
await this.depker.config.service(MongoPlugin.NAME, () => config);
359359
}
360360

src/core/mysql/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ export class MysqlPlugin implements DepkerPlugin {
220220

221221
const database = name;
222222
const username = name;
223-
const password = generator.generate();
223+
const password = generator.generate(20, true, true, false);
224224

225225
await this.exec([
226226
`DROP USER IF EXISTS ${username}`,
@@ -341,7 +341,7 @@ export class MysqlPlugin implements DepkerPlugin {
341341
const config = await this.depker.config.service<MysqlServiceConfig>(MysqlPlugin.NAME);
342342
if (!config.username || !config.password) {
343343
config.username = "root";
344-
config.password = generator.generate();
344+
config.password = generator.generate(20, true, true, false);
345345
await this.depker.config.service(MysqlPlugin.NAME, () => config);
346346
}
347347

src/core/postgres/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ export class PostgresPlugin implements DepkerPlugin {
170170
value.PGSQL_NAME = database;
171171
value.PGSQL_USER = username;
172172
value.PGSQL_PASS = password;
173-
value.PGSQL_URL = `postgresql://${value.PGSQL_USER}:${value.PGSQL_PASS}@${value.PGSQL_HOST}:${value.PGSQL_PORT}/${value.PGSQL_NAME}`;
173+
value.PGSQL_URL = `postgres://${value.PGSQL_USER}:${value.PGSQL_PASS}@${value.PGSQL_HOST}:${value.PGSQL_PORT}/${value.PGSQL_NAME}?sslmode=disable`;
174174
return value;
175175
});
176176
}
@@ -216,7 +216,7 @@ export class PostgresPlugin implements DepkerPlugin {
216216

217217
const database = name;
218218
const username = name;
219-
const password = generator.generate();
219+
const password = generator.generate(20, true, true, false);
220220

221221
await this.exec([
222222
`DROP USER IF EXISTS ${username}`,
@@ -260,7 +260,7 @@ export class PostgresPlugin implements DepkerPlugin {
260260
value.PGSQL_NAME = name;
261261
value.PGSQL_USER = config.username;
262262
value.PGSQL_PASS = config.password;
263-
value.PGSQL_URL = `postgresql://${value.PGSQL_USER}:${value.PGSQL_PASS}@${value.PGSQL_HOST}:${value.PGSQL_PORT}/${value.PGSQL_NAME}`;
263+
value.PGSQL_URL = `postgres://${value.PGSQL_USER}:${value.PGSQL_PASS}@${value.PGSQL_HOST}:${value.PGSQL_PORT}/${value.PGSQL_NAME}?sslmode=disable`;
264264
return value;
265265
} else if (config.databases?.[name]) {
266266
const value: Record<string, any> = {};
@@ -269,7 +269,7 @@ export class PostgresPlugin implements DepkerPlugin {
269269
value.PGSQL_NAME = name;
270270
value.PGSQL_USER = config.databases[name].username;
271271
value.PGSQL_PASS = config.databases[name].password;
272-
value.PGSQL_URL = `postgresql://${value.PGSQL_USER}:${value.PGSQL_PASS}@${value.PGSQL_HOST}:${value.PGSQL_PORT}/${value.PGSQL_NAME}`;
272+
value.PGSQL_URL = `postgres://${value.PGSQL_USER}:${value.PGSQL_PASS}@${value.PGSQL_HOST}:${value.PGSQL_PORT}/${value.PGSQL_NAME}?sslmode=disable`;
273273
return value;
274274
} else {
275275
throw new Error(`PostgreSQL database is not configured with name: ${name}`);
@@ -327,7 +327,7 @@ export class PostgresPlugin implements DepkerPlugin {
327327
const config = await this.depker.config.service<PostgresServiceConfig>(PostgresPlugin.NAME);
328328
if (!config.username || !config.password) {
329329
config.username = "postgres";
330-
config.password = generator.generate();
330+
config.password = generator.generate(20, true, true, false);
331331
await this.depker.config.service(PostgresPlugin.NAME, () => config);
332332
}
333333

src/core/redis/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ export class RedisPlugin implements DepkerPlugin {
219219
}
220220

221221
const username = name;
222-
const password = generator.generate();
222+
const password = generator.generate(20, true, true, false);
223223
await this.exec(`ACL SETUSER ${username} on allkeys allchannels allcommands >'${password}'`);
224224

225225
config.databases = config.databases ?? {};
@@ -330,7 +330,7 @@ export class RedisPlugin implements DepkerPlugin {
330330
const config = await this.depker.config.service<RedisServiceConfig>(RedisPlugin.NAME);
331331
if (!config.username || !config.password) {
332332
config.username = "default";
333-
config.password = generator.generate();
333+
config.password = generator.generate(20, true, true, false);
334334
await this.depker.config.service(RedisPlugin.NAME, () => config);
335335
}
336336

0 commit comments

Comments
 (0)