Skip to content

Commit

Permalink
add the command to generate the config (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
mastereng12 committed Sep 25, 2024
1 parent ab0d24f commit 622a4be
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ The below commands will allow a developer to run a node and attest to the state
- [generate-config](https://docs.lagrange.dev/state-committees/run-node/commands#generate-config)
- [generate-docker-compose](https://docs.lagrange.dev/state-committees/run-node/commands#generate-docker-compose)
- [deploy](https://docs.lagrange.dev/state-committees/run-node/commands#deploy)
- [generate-signer-config](https://docs.lagrange.dev/state-committees/run-node/commands#generate-signer-config)
- [deploy-signer](https://docs.lagrange.dev/state-committees/run-node/commands#deploy-signer)
- [generate-config-deploy](https://docs.lagrange.dev/state-committees/run-node/commands#generate-config-deploy)
- [bulk-generate-config-deploy](https://docs.lagrange.dev/state-committees/run-node/commands#bulk-generate-config-deploy)
Expand Down
20 changes: 19 additions & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,15 @@ func main() {
},
Action: deployWithConfig,
},
{
Name: "generate-signer-config",
Usage: "Generate config and docker-compose files for the signer gRPC server",
Flags: []cli.Flag{
configFileFlag,
dockerImageFlag,
},
Action: generateSignerConfig,
},
{
Name: "deploy-signer",
Usage: "Deploy the LSC signer gRPC server with the given signer config file",
Expand Down Expand Up @@ -608,7 +617,7 @@ func deployWithConfig(c *cli.Context) error {
return clientDeploy(c)
}

func deploySigner(c *cli.Context) error {
func generateSignerConfig(c *cli.Context) error {
cfg, err := signer.Load(c)
if err != nil {
return fmt.Errorf("failed to load CLI config: %w", err)
Expand All @@ -624,6 +633,15 @@ func deploySigner(c *cli.Context) error {
return fmt.Errorf("failed to generate signer config file: %w", err)
}

return c.Set(flagDockerImage, dockerComposeFilePath)
}

func deploySigner(c *cli.Context) error {
if err := generateSignerConfig(c); err != nil {
return fmt.Errorf("failed to generate signer config: %w", err)
}

dockerComposeFilePath := c.String(flagDockerImage)
return utils.RunDockerImage(dockerComposeFilePath)
}

Expand Down

0 comments on commit 622a4be

Please sign in to comment.