Config update

- private key and flo addr for the admin
- Adding token URL
This commit is contained in:
sairajzero 2021-09-24 03:34:01 +05:30
parent bfc6a1091a
commit 8c31de3ccc
3 changed files with 17 additions and 2 deletions

View File

@ -1,5 +1,7 @@
{ {
"secret": "Secret_For_Session__Enter_A_Strong_String(Text/Password)", "secret": "Secret_For_Session__Enter_A_Strong_String(Text/Password)",
"blockchain_id": "FLO_ID_of_the_admin",
"blockchain_private": "Private_Key_of_the_Admin",
"port": "8080", "port": "8080",
"sql_user": "mySQL_user", "sql_user": "mySQL_user",

View File

@ -10,7 +10,9 @@ const floGlobals = {
}, },
sendAmt: 0.001, sendAmt: 0.001,
fee: 0.0005, fee: 0.0005,
tokenURL: "https://ranchimallflo.duckdns.org/",
token: "rupee"
}; };
(typeof global !== "undefined" ? global : window).cryptocoin = floGlobals.blockchain; (typeof global !== "undefined" ? global : window).cryptocoin = floGlobals.blockchain;
('object' === typeof module) ? module.exports = floGlobals : null; ('object' === typeof module) ? module.exports = floGlobals: null;

View File

@ -10,8 +10,19 @@ const App = require('./app');
const PORT = config['port']; const PORT = config['port'];
module.exports = function startServer(public_dir) { module.exports = function startServer(public_dir) {
global.myPrivKey = config["blockchain_private"];
global.myPubKey = floCrypto.getPubKeyHex(global.myPrivKey);
global.myFloID = floCrypto.getFloID(global.myPubKey);
if (global.myFloID !== config["blockchain_id"] || !floCrypto.verifyPrivKey(global.myPrivKey, global.myFloID)) {
console.error("Invalid Private Key for adminID");
return;
}
floGlobals.adminID = config["blockchain_id"];
global.PUBLIC_DIR = public_dir; global.PUBLIC_DIR = public_dir;
console.log(PUBLIC_DIR); console.log(PUBLIC_DIR, global.myFloID);
Database(config["sql_user"], config["sql_pwd"], config["sql_db"], config["sql_host"]).then(DB => { Database(config["sql_user"], config["sql_pwd"], config["sql_db"], config["sql_host"]).then(DB => {
const app = App(config['secret'], DB); const app = App(config['secret'], DB);
app.listen(PORT, () => console.log(`Server Running at port ${PORT}`)); app.listen(PORT, () => console.log(`Server Running at port ${PORT}`));