mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-28 21:58:15 +02:00
prompt for convert node in installer
This commit is contained in:
parent
117062f1d1
commit
cd34820138
1 changed files with 37 additions and 7 deletions
|
@ -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:"))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue