config.go 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. // DBConf is the set of configuration variables for the DB
  32. DBConf *env.DBConf
  33. // RedisConf is the set of configuration variables for the redis instance
  34. RedisConf *env.RedisConf
  35. // TokenConf contains the config for generating and validating JWT tokens
  36. TokenConf *token.TokenGeneratorConf
  37. // UserNotifier is an object that notifies users of transactions (pw reset, email
  38. // verification, etc)
  39. UserNotifier notifier.UserNotifier
  40. // DOConf is the configuration for a DigitalOcean OAuth client
  41. DOConf *oauth2.Config
  42. // GithubConf is the configuration for a Github OAuth client
  43. GithubConf *oauth2.Config
  44. // GithubAppConf is the configuration for a Github App OAuth client
  45. GithubAppConf *oauth.GithubAppConf
  46. // WSUpgrader upgrades HTTP connections to websocket connections
  47. WSUpgrader *websocket.Upgrader
  48. // URLCache contains a cache of chart names to chart repos
  49. URLCache *urlcache.ChartURLCache
  50. // ProvisionerAgent is the kubernetes client responsible for creating new provisioner
  51. // jobs
  52. ProvisionerAgent *kubernetes.Agent
  53. // IngressAgent is the kubernetes client responsible for creating new ingress
  54. // resources
  55. IngressAgent *kubernetes.Agent
  56. }
  57. type ConfigLoader interface {
  58. LoadConfig() (*Config, error)
  59. }