|
|
@ -187,7 +187,7 @@ export default class Noco { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
await Noco._ncMeta.metaInit(); |
|
|
|
await Noco._ncMeta.metaInit(); |
|
|
|
await this.readOrGenJwtSecret(); |
|
|
|
await this.initJwt(); |
|
|
|
await initAdminFromEnv(); |
|
|
|
await initAdminFromEnv(); |
|
|
|
|
|
|
|
|
|
|
|
await NcUpgrader.upgrade({ ncMeta: Noco._ncMeta }); |
|
|
|
await NcUpgrader.upgrade({ ncMeta: Noco._ncMeta }); |
|
|
@ -489,8 +489,9 @@ export default class Noco { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private async readOrGenJwtSecret(): Promise<any> { |
|
|
|
private async initJwt(): Promise<any> { |
|
|
|
if (this.config?.auth?.jwt && !this.config.auth.jwt.secret) { |
|
|
|
if (this.config?.auth?.jwt) { |
|
|
|
|
|
|
|
if (!this.config.auth.jwt.secret) { |
|
|
|
let secret = ( |
|
|
|
let secret = ( |
|
|
|
await Noco._ncMeta.metaGet('', '', 'nc_store', { |
|
|
|
await Noco._ncMeta.metaGet('', '', 'nc_store', { |
|
|
|
key: 'nc_auth_jwt_secret' |
|
|
|
key: 'nc_auth_jwt_secret' |
|
|
@ -504,6 +505,13 @@ export default class Noco { |
|
|
|
} |
|
|
|
} |
|
|
|
this.config.auth.jwt.secret = secret; |
|
|
|
this.config.auth.jwt.secret = secret; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.config.auth.jwt.options = this.config.auth.jwt.options || {}; |
|
|
|
|
|
|
|
if (!this.config.auth.jwt.options?.expiresIn) { |
|
|
|
|
|
|
|
this.config.auth.jwt.options.expiresIn = |
|
|
|
|
|
|
|
process.env.NC_JWT_EXPIRES_IN ?? '10h'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
let serverId = ( |
|
|
|
let serverId = ( |
|
|
|
await Noco._ncMeta.metaGet('', '', 'nc_store', { |
|
|
|
await Noco._ncMeta.metaGet('', '', 'nc_store', { |
|
|
|
key: 'nc_server_id' |
|
|
|
key: 'nc_server_id' |
|
|
|