29 lines
846 B
Go
29 lines
846 B
Go
// Command fakeglpi boots the in-memory fake GLPI on a fixed address for
|
|
// the smoke run (see smoke/smoke.sh), with a few demo CIs seeded and an
|
|
// optional agent-profile gate. The real CMDB is never contacted.
|
|
package main
|
|
|
|
import (
|
|
"flag"
|
|
"log"
|
|
"os"
|
|
|
|
"git.knownelement.com/ukrrs/mopac-glpi-go/internal/fakeglpi"
|
|
)
|
|
|
|
func main() {
|
|
addr := flag.String("addr", ":8602", "listen address")
|
|
requireProfile := flag.Int("require-change-profile", 0, "reject change creation unless this profile is active (agent-mode gate)")
|
|
flag.Parse()
|
|
app := os.Getenv("FAKE_APP_TOKEN")
|
|
if app == "" {
|
|
app = "smoke-app-token-0123456789"
|
|
}
|
|
user := os.Getenv("FAKE_USER_TOKEN")
|
|
if user == "" {
|
|
user = "smoke-user-token-0123456789"
|
|
}
|
|
log.Printf("fakeglpi listening on %s", *addr)
|
|
log.Fatal(fakeglpi.ListenAndServe(*addr, app, user, *requireProfile))
|
|
}
|