mirror of
https://github.com/DeBrosOfficial/network.git
synced 2025-12-12 22:58:49 +00:00
feat: enhance setup command with validation and refactor
- Added validation functions for multiaddr and host:port formats to improve user input handling during setup. - Refactored the setup command steps for clarity and consistency, ensuring proper sequence in the setup process. - Removed the `initializeEnvironments` function and its related logic to streamline the setup flow. - Updated the cloning process to use a shallow clone for efficiency. - Enhanced service configuration to use environment variables for better management.
This commit is contained in:
parent
3b4d43f808
commit
a9ac3fcb83
2
Makefile
2
Makefile
@ -21,7 +21,7 @@ test-e2e:
|
||||
|
||||
.PHONY: build clean test run-node run-node2 run-node3 run-example deps tidy fmt vet lint clear-ports
|
||||
|
||||
VERSION := 0.52.5
|
||||
VERSION := 0.52.6
|
||||
COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo unknown)
|
||||
DATE ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
|
||||
LDFLAGS := -X 'main.version=$(VERSION)' -X 'main.commit=$(COMMIT)' -X 'main.date=$(DATE)'
|
||||
|
||||
@ -380,21 +380,12 @@ func cloneAndBuild() {
|
||||
// Build
|
||||
fmt.Printf(" Building binaries...\n")
|
||||
|
||||
// Properly build environment with Go in PATH, avoiding duplicate PATH entries
|
||||
var env []string
|
||||
goPath := os.Getenv("PATH") + ":/usr/local/go/bin"
|
||||
for _, e := range os.Environ() {
|
||||
// Skip existing PATH entries to avoid duplicates
|
||||
if !strings.HasPrefix(e, "PATH=") {
|
||||
env = append(env, e)
|
||||
}
|
||||
}
|
||||
// Add our modified PATH with Go
|
||||
env = append(env, "PATH="+goPath)
|
||||
// Ensure Go is in PATH for the build
|
||||
os.Setenv("PATH", os.Getenv("PATH")+":/usr/local/go/bin")
|
||||
|
||||
cmd := exec.Command("sudo", "-u", "debros", "make", "build")
|
||||
// Use sudo with --preserve-env=PATH to pass Go path to debros user
|
||||
cmd := exec.Command("sudo", "--preserve-env=PATH", "-u", "debros", "make", "build")
|
||||
cmd.Dir = "/home/debros/src"
|
||||
cmd.Env = env
|
||||
if output, err := cmd.CombinedOutput(); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "❌ Failed to build: %v\n%s\n", err, output)
|
||||
os.Exit(1)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user