main.go 991 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package main
  2. import (
  3. "os"
  4. "git.ikuban.com/server/kugo-layout/config"
  5. "git.ikuban.com/server/kugo-layout/controller"
  6. "git.ikuban.com/server/kugo/server"
  7. "git.ikuban.com/server/kugo"
  8. "git.ikuban.com/server/kugo/transport/http"
  9. )
  10. var (
  11. name string
  12. group string
  13. namespace string
  14. configSource string
  15. )
  16. func init() {
  17. if os.Getenv("KUGO_GROUP") != "" {
  18. group = os.Getenv("KUGO_GROUP")
  19. }
  20. if os.Getenv("KUGO_NAMESPACE") != "" {
  21. namespace = os.Getenv("KUGO_NAMESPACE")
  22. }
  23. if os.Getenv("KUGO_CONFIG_SOURCE") != "" {
  24. configSource = os.Getenv("KUGO_CONFIG_SOURCE")
  25. }
  26. }
  27. func main() {
  28. app := kugo.New(
  29. kugo.WithRemoteConf(configSource, name, group, namespace),
  30. kugo.WithConf(&config.Conf{}),
  31. kugo.WithHttpController(initController),
  32. kugo.WithInitServices(initServices))
  33. app.Run()
  34. }
  35. func controllers(base *controller.Base) []http.Controller {
  36. return []http.Controller{
  37. base,
  38. }
  39. }
  40. func services() []server.Service {
  41. return []server.Service{}
  42. }