mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 17:46:28 +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
@@ -21,7 +21,7 @@ class MongoService {
|
||||
private opts: MongoConfig;
|
||||
|
||||
static buildUrl(opts: MongoConfig) {
|
||||
let mongourl = `${opts.protocol}://`;
|
||||
let mongourl = `${opts.protocol || 'mongodb'}://`;
|
||||
if (opts.username) mongourl += `${opts.username}:${opts.password}@`;
|
||||
mongourl += `${opts.host}:${opts.port}/${opts.name}`;
|
||||
if (opts.url) mongourl = opts.url;
|
||||
|
||||
@@ -289,8 +289,8 @@ export class HandlerCommon {
|
||||
...this.user,
|
||||
gravatar: misc.gravatar(this.user.gravatar || '', 128),
|
||||
perm: this.user.perm.toString(),
|
||||
viewLang: this.translate('__id'),
|
||||
};
|
||||
UserContext.viewLang = this.translate('__id');
|
||||
if (!global.Hydro.lib.template) return JSON.stringify(context);
|
||||
const res = await global.Hydro.lib.template.render(name, {
|
||||
handler: this,
|
||||
|
||||
Reference in new issue
Block a user