Skip to content

Commit 435fb01

Browse files
committed
add xdpos gen
1 parent c8f6b5f commit 435fb01

File tree

14 files changed

+1006
-9
lines changed

14 files changed

+1006
-9
lines changed

container-manager/src/express.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ app.get("/gen", (req, res) => {
119119
res.render("generator/index.pug", {});
120120
});
121121

122+
app.get("/gen_xdpos", (req, res) => {
123+
res.render("xdpos_generator/index.pug", {});
124+
});
125+
122126
app.post("/submit", (req, res) => {
123127
console.log("/submit called");
124128
const [valid, genOut] = exec.generate(req.body);
@@ -136,6 +140,23 @@ app.post("/submit", (req, res) => {
136140
}
137141
});
138142

143+
app.post("/submit_xdpos", (req, res) => {
144+
console.log("/submit_xdpos called");
145+
const [valid, genOut] = exec.generateXdpos(req.body);
146+
if (!valid) {
147+
res.render("xdpos_generator/submit.pug", {
148+
message: "failed, please try again",
149+
error: genOut,
150+
});
151+
} else {
152+
res.render("xdpos_generator/submit.pug", {
153+
message:
154+
"Config generation success, please continue with 'cd generated;' then './docker-up.sh machine1;'",
155+
});
156+
process.exit(0);
157+
}
158+
});
159+
139160
app.post("/submit_preconfig", (req, res) => {
140161
console.log("/submit called");
141162
const [valid, genOut] = exec.generate(req.body);

container-manager/src/gen/config_gen.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ const config = {
5454
generator: {
5555
output_path: `${__dirname}/../../mount/generated/`,
5656
},
57+
xdpos: {
58+
xdposnode: process.env.VERSION_NODE_IMAGE || "xinfinorg/xdposchain:v2.6.4-beta",
59+
stake_threshold: parseInt(process.env.MASTERNODE_MINIMUM_STAKE) || "",
60+
reward_yield: parseInt(process.env.REWARDS_YIELD) || "",
61+
foundation_addr: "",
62+
foundation_pk: process.env.FOUNDATION_PK || ""
63+
}
5764
};
5865

5966
// if (configSanityCheck(config) === true) {

0 commit comments

Comments
 (0)