rename envi to envar

This commit is contained in:
陆柯 2022-04-03 16:19:57 +08:00
parent 4c807cf458
commit 1b1ef70049

View File

@ -5,8 +5,8 @@ const crypto = require('crypto')
const my = {} const my = {}
module.exports = { module.exports = {
init (envi) { init (envar) {
my.tokenKey = envi.tokenKey my.tokenKey = envar.tokenKey
}, },
createToken: function (content, key) { createToken: function (content, key) {
// content 可以是数字,非空字符串或非空对象,不可以是数组。 // content 可以是数字,非空字符串或非空对象,不可以是数组。
@ -16,7 +16,7 @@ module.exports = {
content, content,
crypto crypto
.createHash('sha256') .createHash('sha256')
.update(key || my.tokenKey || wo.envi.tokenKey || '', 'utf8') .update(key || my.tokenKey || wo.envar.tokenKey || '', 'utf8')
.digest('hex') .digest('hex')
) )
} catch (exp) { } catch (exp) {
@ -29,7 +29,7 @@ module.exports = {
token, token,
crypto crypto
.createHash('sha256') .createHash('sha256')
.update(key || my.tokenKey || wo.envi.tokenKey || '', 'utf8') .update(key || my.tokenKey || wo.envar.tokenKey || '', 'utf8')
.digest('hex') .digest('hex')
) )
} catch (exp) { } catch (exp) {