Skip to content

Commit dc46d2a

Browse files
committed
Some Fix In Store Options
1 parent e07b1e2 commit dc46d2a

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

greenlockManager/index.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ module.exports.handlers = (storeOptions) => {
104104
return {
105105
add: async ({ subject = "", altnames = [] }) => {
106106
altnames = altnames.length === 0 ? [subject] : altnames;
107-
storeOptions.db = await getDB(storeOptions);
108-
return storeOptions.db.Domain.create({
107+
let db = await getDB(storeOptions);
108+
return db.Domain.create({
109109
subject: subject,
110110
altnames: altnames.join(","),
111111
renewAt: 1,
@@ -114,23 +114,23 @@ module.exports.handlers = (storeOptions) => {
114114

115115
// @params sub: subject
116116
getCertificates: async ( sub = "") => {
117-
storeOptions.db = await getDB(storeOptions);
117+
let db = await getDB(storeOptions);
118118

119119
const certificates = {
120120
ca: '',
121121
cert: '',
122122
key: ''
123123
}
124124
try {
125-
const certificateData = await storeOptions.db.Certificate.findOne({
125+
const certificateData = await db.Certificate.findOne({
126126
where: {
127127
subject: sub,
128128
},
129129
attributes: {
130130
exclude: ["createdAt", "updatedAt"],
131131
},
132132
include: {
133-
model: storeOptions.db.Chain,
133+
model:db.Chain,
134134
},
135135
});
136136
// console.log(certificateData);
@@ -142,7 +142,7 @@ module.exports.handlers = (storeOptions) => {
142142
certificates['ca'] = obj.Chain.content;
143143
certificates['cert'] = obj.cert;
144144

145-
const keyContent = await storeOptions.db.Keypair.findOne({
145+
const keyContent = await db.Keypair.findOne({
146146
where: {
147147
xid: sub // Don't use xid of chain. They do not link
148148
}
@@ -179,8 +179,8 @@ module.exports.handlers = (storeOptions) => {
179179
}
180180
},
181181
getDB: async ()=>{
182-
storeOptions.db = await getDB(storeOptions);
183-
return storeOptions.db;
182+
let db = await getDB(storeOptions);
183+
return db;
184184
}
185185
};
186186
};

0 commit comments

Comments
 (0)