mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: fix database connection
This commit is contained in:
1 parent
551cf9c19f
commit
2b6986bd58
4 files changed
+4
-4
No files matched your search
@@ -23,7 +23,7 @@ if (!cluster.isMaster) {
|
|||||||
|
|
||||||
if (argv._[0] === 'db') {
|
if (argv._[0] === 'db') {
|
||||||
function buildUrl(opts) {
|
function buildUrl(opts) {
|
||||||
let mongourl = `${opts.protocol}://`;
|
let mongourl = `${opts.protocol || 'mongodb'}://`;
|
||||||
if (opts.username) mongourl += `${opts.username}:${opts.password}@`;
|
if (opts.username) mongourl += `${opts.username}:${opts.password}@`;
|
||||||
mongourl += `${opts.host}:${opts.port}/${opts.name}`;
|
mongourl += `${opts.host}:${opts.port}/${opts.name}`;
|
||||||
if (opts.url) mongourl = opts.url;
|
if (opts.url) mongourl = opts.url;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "2.20.33",
|
"version": "2.20.34",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "dist/loader.js",
|
"main": "dist/loader.js",
|
||||||
"typings": "dist/loader.d.ts",
|
"typings": "dist/loader.d.ts",
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class MongoService {
|
|||||||
private opts: MongoConfig;
|
private opts: MongoConfig;
|
||||||
|
|
||||||
static buildUrl(opts: MongoConfig) {
|
static buildUrl(opts: MongoConfig) {
|
||||||
let mongourl = `${opts.protocol}://`;
|
let mongourl = `${opts.protocol || 'mongodb'}://`;
|
||||||
if (opts.username) mongourl += `${opts.username}:${opts.password}@`;
|
if (opts.username) mongourl += `${opts.username}:${opts.password}@`;
|
||||||
mongourl += `${opts.host}:${opts.port}/${opts.name}`;
|
mongourl += `${opts.host}:${opts.port}/${opts.name}`;
|
||||||
if (opts.url) mongourl = opts.url;
|
if (opts.url) mongourl = opts.url;
|
||||||
|
|||||||
@@ -289,8 +289,8 @@ export class HandlerCommon {
|
|||||||
...this.user,
|
...this.user,
|
||||||
gravatar: misc.gravatar(this.user.gravatar || '', 128),
|
gravatar: misc.gravatar(this.user.gravatar || '', 128),
|
||||||
perm: this.user.perm.toString(),
|
perm: this.user.perm.toString(),
|
||||||
|
viewLang: this.translate('__id'),
|
||||||
};
|
};
|
||||||
UserContext.viewLang = this.translate('__id');
|
|
||||||
if (!global.Hydro.lib.template) return JSON.stringify(context);
|
if (!global.Hydro.lib.template) return JSON.stringify(context);
|
||||||
const res = await global.Hydro.lib.template.render(name, {
|
const res = await global.Hydro.lib.template.render(name, {
|
||||||
handler: this,
|
handler: this,
|
||||||
|
|||||||
Reference in new issue
Block a user