config.go 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. package config
  2. import (
  3. "github.com/gorilla/sessions"
  4. "github.com/gorilla/websocket"
  5. "github.com/porter-dev/porter/api/server/shared/apierrors/alerter"
  6. "github.com/porter-dev/porter/api/server/shared/config/env"
  7. "github.com/porter-dev/porter/internal/auth/token"
  8. "github.com/porter-dev/porter/internal/helm/urlcache"
  9. "github.com/porter-dev/porter/internal/kubernetes"
  10. "github.com/porter-dev/porter/internal/logger"
  11. "github.com/porter-dev/porter/internal/notifier"
  12. "github.com/porter-dev/porter/internal/oauth"
  13. "github.com/porter-dev/porter/internal/repository"
  14. "golang.org/x/oauth2"
  15. )
  16. type Config struct {
  17. // Logger for logging
  18. Logger *logger.Logger
  19. // Repo implements a query repository
  20. Repo repository.Repository
  21. // Metadata is a description object for the server metadata, used
  22. // to determine which endpoints to register
  23. Metadata *Metadata
  24. // Alerter sends messages to alert aggregators (like Sentry) if the
  25. // error is fatal
  26. Alerter alerter.Alerter
  27. // Store implements a session store for session-based cookies
  28. Store sessions.Store
  29. // ServerConf is the set of configuration variables for the Porter server
  30. ServerConf *env.ServerConf
  31. // TokenConf contains the config for generating and validating JWT tokens
  32. TokenConf *token.TokenGeneratorConf
  33. // UserNotifier is an object that notifies users of transactions (pw reset, email
  34. // verification, etc)
  35. UserNotifier notifier.UserNotifier
  36. // DOConf is the configuration for a DigitalOcean OAuth client
  37. DOConf *oauth2.Config
  38. // GithubConf is the configuration for a Github OAuth client
  39. GithubConf *oauth2.Config
  40. // GithubAppConf is the configuration for a Github App OAuth client
  41. GithubAppConf *oauth.GithubAppConf
  42. // WSUpgrader upgrades HTTP connections to websocket connections
  43. WSUpgrader *websocket.Upgrader
  44. // URLCache contains a cache of chart names to chart repos
  45. URLCache *urlcache.ChartURLCache
  46. // ProvisionerAgent is the kubernetes client responsible for creating new provisioner
  47. // jobs
  48. ProvisionerAgent *kubernetes.Agent
  49. // IngressAgent is the kubernetes client responsible for creating new ingress
  50. // resources
  51. IngressAgent *kubernetes.Agent
  52. }
  53. type ConfigLoader interface {
  54. LoadConfig() (*Config, error)
  55. }