Skip to content

Commit

Permalink
Some Fix In Store Options
Browse files Browse the repository at this point in the history
  • Loading branch information
Anasnew99 committed Nov 19, 2021
1 parent e07b1e2 commit dc46d2a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions greenlockManager/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ module.exports.handlers = (storeOptions) => {
return {
add: async ({ subject = "", altnames = [] }) => {
altnames = altnames.length === 0 ? [subject] : altnames;
storeOptions.db = await getDB(storeOptions);
return storeOptions.db.Domain.create({
let db = await getDB(storeOptions);
return db.Domain.create({
subject: subject,
altnames: altnames.join(","),
renewAt: 1,
Expand All @@ -114,23 +114,23 @@ module.exports.handlers = (storeOptions) => {

// @params sub: subject
getCertificates: async ( sub = "") => {
storeOptions.db = await getDB(storeOptions);
let db = await getDB(storeOptions);

const certificates = {
ca: '',
cert: '',
key: ''
}
try {
const certificateData = await storeOptions.db.Certificate.findOne({
const certificateData = await db.Certificate.findOne({
where: {
subject: sub,
},
attributes: {
exclude: ["createdAt", "updatedAt"],
},
include: {
model: storeOptions.db.Chain,
model:db.Chain,
},
});
// console.log(certificateData);
Expand All @@ -142,7 +142,7 @@ module.exports.handlers = (storeOptions) => {
certificates['ca'] = obj.Chain.content;
certificates['cert'] = obj.cert;

const keyContent = await storeOptions.db.Keypair.findOne({
const keyContent = await db.Keypair.findOne({
where: {
xid: sub // Don't use xid of chain. They do not link
}
Expand Down Expand Up @@ -179,8 +179,8 @@ module.exports.handlers = (storeOptions) => {
}
},
getDB: async ()=>{
storeOptions.db = await getDB(storeOptions);
return storeOptions.db;
let db = await getDB(storeOptions);
return db;
}
};
};

0 comments on commit dc46d2a

Please sign in to comment.