diff --git a/.air.toml b/.air.toml new file mode 100644 index 0000000..29d45dc --- /dev/null +++ b/.air.toml @@ -0,0 +1,28 @@ +# Air configuration file for Go live reload + +root = "." +tmp_dir = "tmp" + +[build] +cmd = "go build -o ./tmp/main ./cmd/main.go" +bin = "./tmp/main" +include_ext = ["go"] +exclude_dir = ["tmp", "vendor"] +exclude_file = [] +follow_symlink = true +delay = 1000 # ms +log = "build.log" +send_interrupt = true +kill_delay = 500 + +[log] +time = true + +[color] +main = "yellow" +watcher = "cyan" +build = "green" +runner = "magenta" + +[misc] +clean_on_exit = true diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..057c63a --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# air +tmp \ No newline at end of file diff --git a/README.md b/README.md index 8b13789..8ae4215 100644 --- a/README.md +++ b/README.md @@ -1 +1,30 @@ +# Validator Tracker Notifier +## Development Mode (Dev Mode) + +This project supports a development mode with automatic reload on code changes using [air](https://github.com/cosmtrek/air). + +### Prerequisites + +- [Go](https://golang.org/dl/) installed +- [air](https://github.com/cosmtrek/air) installed (install with `go install github.com/cosmtrek/air@latest`) + +### Running in Dev Mode + +To start the application in development mode with live reload and debug logging: + +```sh +LOG_LEVEL=DEBUG air +``` + +This will watch for file changes and automatically restart the app. You can edit code and see changes reflected immediately. + +### Example + +```sh +# Install air if you haven't already +go install github.com/air-verse/air@latest + +# Run in dev mode with debug logs +LOG_LEVEL=DEBUG air +``` diff --git a/cmd/main.go b/cmd/main.go index 57f5069..a899cf8 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -23,7 +23,7 @@ import ( func main() { // Load config cfg := config.LoadConfig() - logger.Info("Loaded config: network=%s, beaconEndpoint=%s, web3SignerEndpoint=%s", + logger.Info("Loaded e config: network=%s, beaconEndpoint=%s, web3SignerEndpoint=%s", cfg.Network, cfg.BeaconEndpoint, cfg.Web3SignerEndpoint) // Initialize adapters diff --git a/internal/adapters/beacon/beacon.go b/internal/adapters/beacon/beacon.go index cd3e628..4a36207 100644 --- a/internal/adapters/beacon/beacon.go +++ b/internal/adapters/beacon/beacon.go @@ -18,6 +18,7 @@ import ( "github.com/attestantio/go-eth2-client/spec/phase0" ) +// TODO: should the adapter avoid returning err when initializing? // TODO: implement slash method type beaconAttestantClient struct { diff --git a/internal/config/config_loader.go b/internal/config/config_loader.go index f1c28ae..347a284 100644 --- a/internal/config/config_loader.go +++ b/internal/config/config_loader.go @@ -28,7 +28,7 @@ func LoadConfig() Config { beaconEndpoint := fmt.Sprintf("http://beacon-chain.%s.dncore.dappnode:3500", network) web3SignerEndpoint := fmt.Sprintf("http://web3signer.web3signer-%s.dappnode:9000", network) dappmanagerEndpoint := "http://dappmanager.dappnode" - notifierEndpoint := "http://notifier.dappnode:8080" + notifierEndpoint := "http://notifier.dappnode:8080f" // Allow override via environment variables if envBeacon := os.Getenv("BEACON_ENDPOINT"); envBeacon != "" {