Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add smanager mode #112

Merged
merged 2 commits into from
Jan 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
## node configurations
node:
## the type of crust, for example: authority, full
## the type of crust: authority/full
chain: "authority"
## enable or disable sworker
## the type of sworker: disable/enable
sworker: "enable"
## enable or disable smanager
## the type of smanager: disable/isolation/member
smanager: "disable"
## enable or disable ipfs
## the type of ipfs: disable/enable
ipfs: "disable"

## identity configurations
Expand Down
4 changes: 4 additions & 0 deletions generator/config-gen/smanager-config.gen.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ async function genSmanagerConfig(config, outputCfg) {
chain_addr: 'ws://127.0.0.1:19944',
ipfs_addr: 'http://127.0.0.1:5001',
sworker_addr: 'http://127.0.0.1:12222',
mode: config.node.smanager,
address: config.identity.backup.address,
}
return {
config: smanagerConfig,
Expand All @@ -15,6 +17,8 @@ async function genSmanagerConfig(config, outputCfg) {
'ws://127.0.0.1:19944',
'http://127.0.0.1:5001',
'http://127.0.0.1:12222',
config.node.smanager,
config.identity.backup.address,
].join(' ')
return {
image: 'crustio/crust-smanager:latest',
Expand Down
3 changes: 2 additions & 1 deletion generator/schema/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ function getConfigSchema(config) {
sMap["sworker"] = Joi.object().default()
}

if (config.node.smanager == "enable") {
if (config.node.smanager != "disable") {
sMap["identity"] = identitySchema.required()
sMap["smanager"] = Joi.object().default()
}

Expand Down
2 changes: 1 addition & 1 deletion generator/schema/node.schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const Joi = require('joi')
const nodeSchema = Joi.object({
chain: Joi.string().valid('authority', 'full').required(),
sworker: Joi.string().valid('enable', 'disable').required(),
smanager: Joi.string().valid('enable', 'disable').required(),
smanager: Joi.string().valid('disable', 'isolation', 'member').required(),
ipfs: Joi.string().valid('enable', 'disable').required(),
})

Expand Down
2 changes: 1 addition & 1 deletion scripts/crust.sh
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,7 @@ config_set_all()
return
else
sed -i '6c \\ sworker: "enable"' $basedir/config.yaml &>/dev/null
sed -i '8c \\ smanager: "enable"' $basedir/config.yaml &>/dev/null
sed -i '8c \\ smanager: "'$mode'"' $basedir/config.yaml &>/dev/null
sed -i '10c \\ ipfs: "enable"' $basedir/config.yaml &>/dev/null
log_success "Set crust node mode: '$mode' successfully"
fi
Expand Down