From 8c31de3cccaf09accb0a5cef1a0c3227071a57af Mon Sep 17 00:00:00 2001 From: sairajzero Date: Fri, 24 Sep 2021 03:34:01 +0530 Subject: [PATCH] Config update - private key and flo addr for the admin - Adding token URL --- args/config-sample.json | 2 ++ src/floGlobals.js | 4 +++- src/main.js | 13 ++++++++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/args/config-sample.json b/args/config-sample.json index cb7d5b6..f380d30 100644 --- a/args/config-sample.json +++ b/args/config-sample.json @@ -1,5 +1,7 @@ { "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", "sql_user": "mySQL_user", diff --git a/src/floGlobals.js b/src/floGlobals.js index a13b291..4d9a177 100644 --- a/src/floGlobals.js +++ b/src/floGlobals.js @@ -10,7 +10,9 @@ const floGlobals = { }, sendAmt: 0.001, fee: 0.0005, + tokenURL: "https://ranchimallflo.duckdns.org/", + token: "rupee" }; (typeof global !== "undefined" ? global : window).cryptocoin = floGlobals.blockchain; -('object' === typeof module) ? module.exports = floGlobals : null; \ No newline at end of file +('object' === typeof module) ? module.exports = floGlobals: null; \ No newline at end of file diff --git a/src/main.js b/src/main.js index 73da8ca..54e5916 100644 --- a/src/main.js +++ b/src/main.js @@ -10,8 +10,19 @@ const App = require('./app'); const PORT = config['port']; 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; - 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 => { const app = App(config['secret'], DB); app.listen(PORT, () => console.log(`Server Running at port ${PORT}`));