Skip to content

Commit

Permalink
refactor: move node configs to config/node (#3600)
Browse files Browse the repository at this point in the history
  • Loading branch information
darioush authored Dec 27, 2024
1 parent 6420330 commit b97bbbd
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 6 deletions.
4 changes: 3 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import (
"github.com/ava-labs/avalanchego/utils/logging"
"github.com/ava-labs/avalanchego/utils/perms"
"github.com/ava-labs/avalanchego/utils/ulimit"

nodeconfig "github.com/ava-labs/avalanchego/config/node"
)

const Header = ` _____ .__ .__
Expand All @@ -44,7 +46,7 @@ type App interface {
ExitCode() (int, error)
}

func New(config node.Config) (App, error) {
func New(config nodeconfig.Config) (App, error) {
// Set the data directory permissions to be read write.
if err := perms.ChmodR(config.DatabaseConfig.Path, true, perms.ReadWriteExecute); err != nil {
return nil, fmt.Errorf("failed to restrict the permissions of the database directory with: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ import (

"github.com/ava-labs/avalanchego/api/server"
"github.com/ava-labs/avalanchego/chains"
"github.com/ava-labs/avalanchego/config/node"
"github.com/ava-labs/avalanchego/genesis"
"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/network"
"github.com/ava-labs/avalanchego/network/dialer"
"github.com/ava-labs/avalanchego/network/throttling"
"github.com/ava-labs/avalanchego/node"
"github.com/ava-labs/avalanchego/snow/consensus/snowball"
"github.com/ava-labs/avalanchego/snow/networking/benchlist"
"github.com/ava-labs/avalanchego/snow/networking/router"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 4 additions & 3 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
"github.com/ava-labs/avalanchego/api/server"
"github.com/ava-labs/avalanchego/chains"
"github.com/ava-labs/avalanchego/chains/atomic"
"github.com/ava-labs/avalanchego/config/node"
"github.com/ava-labs/avalanchego/database"
"github.com/ava-labs/avalanchego/database/leveldb"
"github.com/ava-labs/avalanchego/database/memdb"
Expand Down Expand Up @@ -117,7 +118,7 @@ var (

// New returns an instance of Node
func New(
config *Config,
config *node.Config,
logFactory logging.Factory,
logger logging.Logger,
) (*Node, error) {
Expand Down Expand Up @@ -356,7 +357,7 @@ type Node struct {
APIServer server.Server

// This node's configuration
Config *Config
Config *node.Config

tracer trace.Tracer

Expand Down Expand Up @@ -649,7 +650,7 @@ func (n *Node) writeProcessContext() error {
n.Log.Info("writing process context", zap.String("path", n.Config.ProcessContextFilePath))

// Write the process context to disk
processContext := &ProcessContext{
processContext := &node.ProcessContext{
PID: os.Getpid(),
URI: n.apiURI,
StakingAddress: n.stakingAddress, // Set by network initialization
Expand Down
2 changes: 1 addition & 1 deletion tests/fixture/tmpnet/node_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"go.uber.org/zap"

"github.com/ava-labs/avalanchego/config"
"github.com/ava-labs/avalanchego/node"
"github.com/ava-labs/avalanchego/config/node"
"github.com/ava-labs/avalanchego/utils/logging"
"github.com/ava-labs/avalanchego/utils/perms"
)
Expand Down

0 comments on commit b97bbbd

Please sign in to comment.