Setup and integrate GQL server (#12)
Integration Tests / test-integration (push) Successful in 1m17s
Integration Tests / test-integration (push) Successful in 1m17s
Reviewed-on: deep-stack/laconic2d#12 Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com> Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
This commit was merged in pull request #12.
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
|
||||
dbm "github.com/cosmos/cosmos-db"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
"golang.org/x/sync/errgroup"
|
||||
|
||||
"cosmossdk.io/log"
|
||||
confixcmd "cosmossdk.io/tools/confix/cmd"
|
||||
@@ -26,6 +28,7 @@ import (
|
||||
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
|
||||
|
||||
"git.vdb.to/cerc-io/laconic2d/app"
|
||||
"git.vdb.to/cerc-io/laconic2d/gql"
|
||||
)
|
||||
|
||||
func initRootCmd(rootCmd *cobra.Command, txConfig client.TxConfig, basicManager module.BasicManager) {
|
||||
@@ -40,7 +43,20 @@ func initRootCmd(rootCmd *cobra.Command, txConfig client.TxConfig, basicManager
|
||||
snapshot.Cmd(newApp),
|
||||
)
|
||||
|
||||
server.AddCommands(rootCmd, app.DefaultNodeHome, newApp, appExport, func(startCmd *cobra.Command) {})
|
||||
server.AddCommands(rootCmd, app.DefaultNodeHome, newApp, appExport, func(startCmd *cobra.Command) {
|
||||
// Override start command to run the GQL server
|
||||
newStartCmd := server.StartCmdWithOptions(newApp, app.DefaultNodeHome, server.StartCmdOptions{
|
||||
PostSetup: func(svrCtx *server.Context, clientCtx client.Context, ctx context.Context, g *errgroup.Group) error {
|
||||
g.Go(func() error {
|
||||
return gql.Server(ctx, clientCtx, svrCtx.Logger.With("module", "gql-server"))
|
||||
})
|
||||
|
||||
return nil
|
||||
},
|
||||
})
|
||||
|
||||
startCmd.RunE = newStartCmd.RunE
|
||||
})
|
||||
|
||||
// add keybase, auxiliary RPC, query, genesis, and tx child commands
|
||||
rootCmd.AddCommand(
|
||||
|
||||
@@ -27,6 +27,7 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
|
||||
"git.vdb.to/cerc-io/laconic2d/app"
|
||||
"git.vdb.to/cerc-io/laconic2d/gql"
|
||||
)
|
||||
|
||||
const EnvPrefix = "LACONIC"
|
||||
@@ -106,7 +107,7 @@ func NewRootCmd() *cobra.Command {
|
||||
// overwrite the block timeout
|
||||
cmtCfg := cmtcfg.DefaultConfig()
|
||||
cmtCfg.Consensus.TimeoutCommit = 3 * time.Second
|
||||
cmtCfg.LogLevel = "*:error,p2p:info,state:info,auction:info,bond:info,registry:info" // better default logging
|
||||
cmtCfg.LogLevel = "*:error,p2p:info,state:info,auction:info,bond:info,registry:info,gql-server:info" // better default logging
|
||||
|
||||
return server.InterceptConfigsPreRunHandler(cmd, serverconfig.DefaultConfigTemplate, srvCfg, cmtCfg)
|
||||
},
|
||||
@@ -118,6 +119,9 @@ func NewRootCmd() *cobra.Command {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// Add flags for GQL server.
|
||||
rootCmd = gql.AddGQLFlags(rootCmd)
|
||||
|
||||
return rootCmd
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user