prompt for convert node in installer

This commit is contained in:
miloschwartz 2025-08-18 12:06:59 -07:00
parent 117062f1d1
commit cd34820138
No known key found for this signature in database

View file

@ -239,6 +239,15 @@ func main() {
}
}
// Check if Pangolin is already installed with hybrid section
if checkIsPangolinInstalledWithHybrid() {
fmt.Println("\n=== Convert to Self-Host Node ===")
if readBool(reader, "Do you want to convert this Pangolin instance into a manage self-host node?", true) {
fmt.Println("hello world")
return
}
}
if !checkIsCrowdsecInstalledInCompose() {
fmt.Println("\n=== CrowdSec Install ===")
// check if crowdsec is installed
@ -938,3 +947,24 @@ func checkPortsAvailable(port int) error {
}
return nil
}
func checkIsPangolinInstalledWithHybrid() bool {
// Check if docker-compose.yml exists (indicating Pangolin is installed)
if _, err := os.Stat("docker-compose.yml"); err != nil {
return false
}
// Check if config/config.yml exists and contains hybrid section
if _, err := os.Stat("config/config.yml"); err != nil {
return false
}
// Read config file to check for hybrid section
content, err := os.ReadFile("config/config.yml")
if err != nil {
return false
}
// Check for hybrid section
return bytes.Contains(content, []byte("hybrid:"))
}