mirror of
https://github.com/fosrl/pangolin.git
synced 2025-12-12 10:58:06 +00:00
prompt for convert node in installer
This commit is contained in:
@@ -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:"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user