fmi/main.js

34 lines
869 B
JavaScript
Raw Normal View History

2022-08-26 20:44:20 +02:00
import fmi from "./config.js";
import path from "path";
2021-10-22 21:53:35 +02:00
const conf_struct = {
System:{
PORT:{type:"number",default:80},
2022-08-26 20:44:20 +02:00
URL:{type:"string",default:"https://google.de/",comment:"The exposed URL:"}
2021-10-22 21:53:35 +02:00
},
ssl:{
2022-08-26 20:44:20 +02:00
enable:{type:"boolean",default:true,env:"FMI_SSL_ENABELED"},
2021-10-22 21:53:35 +02:00
privkey:{type:"string",default:"privkey.pem"},
cert:{type:"string",default:"cert.pem"},
chain:{type:"string",default:"chain.pem"}
}
};
2022-08-26 20:44:20 +02:00
console.log()
const mc = new fmi(conf_struct);
mc.connect("./config.juml");
2021-10-22 21:53:35 +02:00
if(mc.get("ssl","enable")){
console.log("SSL Enabled");
mc.readPathes(mc.get("ssl","privkey"),mc.get("ssl","cert"),mc.get("ssl","chain"))
.then(([privkey,cert,chain])=>{
console.log("privkey: ",privkey,"\ncert: ",cert,"\nchain: ",chain);
}).catch(err=>{
console.error(err);
process.exit();
});
}else{
console.log("SSL Disabled");
2022-08-26 20:44:20 +02:00
}