ソースを参照

fix import cycle

Alexander Belanger 4 年 前
コミット
ee40d03659

+ 2 - 92
api/server/shared/config/config.go

@@ -1,11 +1,10 @@
 package config
 
 import (
-	"time"
-
 	"github.com/gorilla/sessions"
 	"github.com/gorilla/websocket"
 	"github.com/porter-dev/porter/api/server/shared/apierrors/alerter"
+	"github.com/porter-dev/porter/api/server/shared/config/env"
 	"github.com/porter-dev/porter/internal/auth/token"
 	"github.com/porter-dev/porter/internal/helm/urlcache"
 	"github.com/porter-dev/porter/internal/kubernetes"
@@ -35,7 +34,7 @@ type Config struct {
 	Store sessions.Store
 
 	// ServerConf is the set of configuration variables for the Porter server
-	ServerConf *ServerConf
+	ServerConf *env.ServerConf
 
 	// TokenConf contains the config for generating and validating JWT tokens
 	TokenConf *token.TokenGeneratorConf
@@ -71,92 +70,3 @@ type Config struct {
 type ConfigLoader interface {
 	LoadConfig() (*Config, error)
 }
-
-// ServerConf is the server configuration
-type ServerConf struct {
-	Debug bool `env:"DEBUG,default=false"`
-
-	ServerURL            string        `env:"SERVER_URL,default=http://localhost:8080"`
-	Port                 int           `env:"SERVER_PORT,default=8080"`
-	StaticFilePath       string        `env:"STATIC_FILE_PATH,default=/porter/static"`
-	CookieName           string        `env:"COOKIE_NAME,default=porter"`
-	CookieSecrets        []string      `env:"COOKIE_SECRETS,default=random_hash_key_;random_block_key"`
-	TokenGeneratorSecret string        `env:"TOKEN_GENERATOR_SECRET,default=secret"`
-	TimeoutRead          time.Duration `env:"SERVER_TIMEOUT_READ,default=5s"`
-	TimeoutWrite         time.Duration `env:"SERVER_TIMEOUT_WRITE,default=10s"`
-	TimeoutIdle          time.Duration `env:"SERVER_TIMEOUT_IDLE,default=15s"`
-	IsLocal              bool          `env:"IS_LOCAL,default=false"`
-	IsTesting            bool          `env:"IS_TESTING,default=false"`
-	AppRootDomain        string        `env:"APP_ROOT_DOMAIN,default=porter.run"`
-
-	DefaultApplicationHelmRepoURL string `env:"HELM_APP_REPO_URL,default=https://charts.dev.getporter.dev"`
-	DefaultAddonHelmRepoURL       string `env:"HELM_ADD_ON_REPO_URL,default=https://chart-addons.dev.getporter.dev"`
-
-	BasicLoginEnabled bool `env:"BASIC_LOGIN_ENABLED,default=true"`
-
-	GithubClientID     string `env:"GITHUB_CLIENT_ID"`
-	GithubClientSecret string `env:"GITHUB_CLIENT_SECRET"`
-	GithubLoginEnabled bool   `env:"GITHUB_LOGIN_ENABLED,default=true"`
-
-	GithubAppClientID      string `env:"GITHUB_APP_CLIENT_ID"`
-	GithubAppClientSecret  string `env:"GITHUB_APP_CLIENT_SECRET"`
-	GithubAppName          string `env:"GITHUB_APP_NAME"`
-	GithubAppWebhookSecret string `env:"GITHUB_APP_WEBHOOK_SECRET"`
-	GithubAppID            string `env:"GITHUB_APP_ID"`
-	GithubAppSecretPath    string `env:"GITHUB_APP_SECRET_PATH"`
-
-	GoogleClientID         string `env:"GOOGLE_CLIENT_ID"`
-	GoogleClientSecret     string `env:"GOOGLE_CLIENT_SECRET"`
-	GoogleRestrictedDomain string `env:"GOOGLE_RESTRICTED_DOMAIN"`
-
-	SendgridAPIKey                  string `env:"SENDGRID_API_KEY"`
-	SendgridPWResetTemplateID       string `env:"SENDGRID_PW_RESET_TEMPLATE_ID"`
-	SendgridPWGHTemplateID          string `env:"SENDGRID_PW_GH_TEMPLATE_ID"`
-	SendgridVerifyEmailTemplateID   string `env:"SENDGRID_VERIFY_EMAIL_TEMPLATE_ID"`
-	SendgridProjectInviteTemplateID string `env:"SENDGRID_INVITE_TEMPLATE_ID"`
-	SendgridSenderEmail             string `env:"SENDGRID_SENDER_EMAIL"`
-
-	SlackClientID     string `env:"SLACK_CLIENT_ID"`
-	SlackClientSecret string `env:"SLACK_CLIENT_SECRET"`
-
-	DOClientID                 string `env:"DO_CLIENT_ID"`
-	DOClientSecret             string `env:"DO_CLIENT_SECRET"`
-	ProvisionerImageTag        string `env:"PROV_IMAGE_TAG,default=latest"`
-	ProvisionerImagePullSecret string `env:"PROV_IMAGE_PULL_SECRET"`
-	SegmentClientKey           string `env:"SEGMENT_CLIENT_KEY"`
-
-	SentryDSN string `env:"SENTRY_DSN"`
-
-	ProvisionerCluster string `env:"PROVISIONER_CLUSTER"`
-	IngressCluster     string `env:"INGRESS_CLUSTER"`
-	SelfKubeconfig     string `env:"SELF_KUBECONFIG"`
-}
-
-// DBConf is the database configuration: if generated from environment variables,
-// it assumes the default docker-compose configuration is used
-type DBConf struct {
-	// EncryptionKey is the key to use for sensitive values that are encrypted at rest
-	EncryptionKey string `env:"ENCRYPTION_KEY,default=__random_strong_encryption_key__"`
-
-	Host     string `env:"DB_HOST,default=postgres"`
-	Port     int    `env:"DB_PORT,default=5432"`
-	Username string `env:"DB_USER,default=porter"`
-	Password string `env:"DB_PASS,default=porter"`
-	DbName   string `env:"DB_NAME,default=porter"`
-	ForceSSL bool   `env:"DB_FORCE_SSL,default=false"`
-
-	SQLLite     bool   `env:"SQL_LITE,default=false"`
-	SQLLitePath string `env:"SQL_LITE_PATH,default=/porter/porter.db"`
-}
-
-// RedisConf is the redis config required for the provisioner container
-type RedisConf struct {
-	// if redis should be used
-	Enabled bool `env:"REDIS_ENABLED,default=true"`
-
-	Host     string `env:"REDIS_HOST,default=redis"`
-	Port     string `env:"REDIS_PORT,default=6379"`
-	Username string `env:"REDIS_USER"`
-	Password string `env:"REDIS_PASS"`
-	DB       int    `env:"REDIS_DB,default=0"`
-}

+ 92 - 0
api/server/shared/config/env/envconfs.go

@@ -0,0 +1,92 @@
+package env
+
+import "time"
+
+// ServerConf is the server configuration
+type ServerConf struct {
+	Debug bool `env:"DEBUG,default=false"`
+
+	ServerURL            string        `env:"SERVER_URL,default=http://localhost:8080"`
+	Port                 int           `env:"SERVER_PORT,default=8080"`
+	StaticFilePath       string        `env:"STATIC_FILE_PATH,default=/porter/static"`
+	CookieName           string        `env:"COOKIE_NAME,default=porter"`
+	CookieSecrets        []string      `env:"COOKIE_SECRETS,default=random_hash_key_;random_block_key"`
+	TokenGeneratorSecret string        `env:"TOKEN_GENERATOR_SECRET,default=secret"`
+	TimeoutRead          time.Duration `env:"SERVER_TIMEOUT_READ,default=5s"`
+	TimeoutWrite         time.Duration `env:"SERVER_TIMEOUT_WRITE,default=10s"`
+	TimeoutIdle          time.Duration `env:"SERVER_TIMEOUT_IDLE,default=15s"`
+	IsLocal              bool          `env:"IS_LOCAL,default=false"`
+	IsTesting            bool          `env:"IS_TESTING,default=false"`
+	AppRootDomain        string        `env:"APP_ROOT_DOMAIN,default=porter.run"`
+
+	DefaultApplicationHelmRepoURL string `env:"HELM_APP_REPO_URL,default=https://charts.dev.getporter.dev"`
+	DefaultAddonHelmRepoURL       string `env:"HELM_ADD_ON_REPO_URL,default=https://chart-addons.dev.getporter.dev"`
+
+	BasicLoginEnabled bool `env:"BASIC_LOGIN_ENABLED,default=true"`
+
+	GithubClientID     string `env:"GITHUB_CLIENT_ID"`
+	GithubClientSecret string `env:"GITHUB_CLIENT_SECRET"`
+	GithubLoginEnabled bool   `env:"GITHUB_LOGIN_ENABLED,default=true"`
+
+	GithubAppClientID      string `env:"GITHUB_APP_CLIENT_ID"`
+	GithubAppClientSecret  string `env:"GITHUB_APP_CLIENT_SECRET"`
+	GithubAppName          string `env:"GITHUB_APP_NAME"`
+	GithubAppWebhookSecret string `env:"GITHUB_APP_WEBHOOK_SECRET"`
+	GithubAppID            string `env:"GITHUB_APP_ID"`
+	GithubAppSecretPath    string `env:"GITHUB_APP_SECRET_PATH"`
+
+	GoogleClientID         string `env:"GOOGLE_CLIENT_ID"`
+	GoogleClientSecret     string `env:"GOOGLE_CLIENT_SECRET"`
+	GoogleRestrictedDomain string `env:"GOOGLE_RESTRICTED_DOMAIN"`
+
+	SendgridAPIKey                  string `env:"SENDGRID_API_KEY"`
+	SendgridPWResetTemplateID       string `env:"SENDGRID_PW_RESET_TEMPLATE_ID"`
+	SendgridPWGHTemplateID          string `env:"SENDGRID_PW_GH_TEMPLATE_ID"`
+	SendgridVerifyEmailTemplateID   string `env:"SENDGRID_VERIFY_EMAIL_TEMPLATE_ID"`
+	SendgridProjectInviteTemplateID string `env:"SENDGRID_INVITE_TEMPLATE_ID"`
+	SendgridSenderEmail             string `env:"SENDGRID_SENDER_EMAIL"`
+
+	SlackClientID     string `env:"SLACK_CLIENT_ID"`
+	SlackClientSecret string `env:"SLACK_CLIENT_SECRET"`
+
+	DOClientID                 string `env:"DO_CLIENT_ID"`
+	DOClientSecret             string `env:"DO_CLIENT_SECRET"`
+	ProvisionerImageTag        string `env:"PROV_IMAGE_TAG,default=latest"`
+	ProvisionerImagePullSecret string `env:"PROV_IMAGE_PULL_SECRET"`
+	SegmentClientKey           string `env:"SEGMENT_CLIENT_KEY"`
+
+	SentryDSN string `env:"SENTRY_DSN"`
+
+	ProvisionerCluster string `env:"PROVISIONER_CLUSTER"`
+	IngressCluster     string `env:"INGRESS_CLUSTER"`
+	SelfKubeconfig     string `env:"SELF_KUBECONFIG"`
+}
+
+// DBConf is the database configuration: if generated from environment variables,
+// it assumes the default docker-compose configuration is used
+type DBConf struct {
+	// EncryptionKey is the key to use for sensitive values that are encrypted at rest
+	EncryptionKey string `env:"ENCRYPTION_KEY,default=__random_strong_encryption_key__"`
+
+	Host     string `env:"DB_HOST,default=postgres"`
+	Port     int    `env:"DB_PORT,default=5432"`
+	Username string `env:"DB_USER,default=porter"`
+	Password string `env:"DB_PASS,default=porter"`
+	DbName   string `env:"DB_NAME,default=porter"`
+	ForceSSL bool   `env:"DB_FORCE_SSL,default=false"`
+
+	SQLLite     bool   `env:"SQL_LITE,default=false"`
+	SQLLitePath string `env:"SQL_LITE_PATH,default=/porter/porter.db"`
+}
+
+// RedisConf is the redis config required for the provisioner container
+type RedisConf struct {
+	// if redis should be used
+	Enabled bool `env:"REDIS_ENABLED,default=true"`
+
+	Host     string `env:"REDIS_HOST,default=redis"`
+	Port     string `env:"REDIS_PORT,default=6379"`
+	Username string `env:"REDIS_USER"`
+	Password string `env:"REDIS_PASS"`
+	DB       int    `env:"REDIS_DB,default=0"`
+}

+ 7 - 7
api/server/shared/config/loader/envloader.go

@@ -4,19 +4,19 @@ import (
 	"fmt"
 
 	"github.com/joeshaw/envdecode"
-	"github.com/porter-dev/porter/api/server/shared/config"
+	"github.com/porter-dev/porter/api/server/shared/config/env"
 )
 
 type EnvDecoderConf struct {
-	ServerConf config.ServerConf
-	RedisConf  config.RedisConf
-	DBConf     config.DBConf
+	ServerConf env.ServerConf
+	RedisConf  env.RedisConf
+	DBConf     env.DBConf
 }
 
 type EnvConf struct {
-	ServerConf *config.ServerConf
-	RedisConf  *config.RedisConf
-	DBConf     *config.DBConf
+	ServerConf *env.ServerConf
+	RedisConf  *env.RedisConf
+	DBConf     *env.DBConf
 }
 
 // FromEnv generates a configuration from environment variables

+ 3 - 2
api/server/shared/config/loader/loader.go

@@ -8,6 +8,7 @@ import (
 	"github.com/gorilla/websocket"
 	"github.com/porter-dev/porter/api/server/shared/apierrors/alerter"
 	"github.com/porter-dev/porter/api/server/shared/config"
+	"github.com/porter-dev/porter/api/server/shared/config/env"
 	"github.com/porter-dev/porter/internal/adapter"
 	"github.com/porter-dev/porter/internal/auth/sessionstore"
 	"github.com/porter-dev/porter/internal/auth/token"
@@ -163,7 +164,7 @@ func (e *EnvConfigLoader) LoadConfig() (res *config.Config, err error) {
 	return res, nil
 }
 
-func getProvisionerAgent(sc *config.ServerConf) (*kubernetes.Agent, error) {
+func getProvisionerAgent(sc *env.ServerConf) (*kubernetes.Agent, error) {
 	if sc.ProvisionerCluster == "kubeconfig" && sc.SelfKubeconfig != "" {
 		agent, err := local.GetSelfAgentFromFileConfig(sc.SelfKubeconfig)
 
@@ -181,7 +182,7 @@ func getProvisionerAgent(sc *config.ServerConf) (*kubernetes.Agent, error) {
 	return agent, nil
 }
 
-func getIngressAgent(sc *config.ServerConf) (*kubernetes.Agent, error) {
+func getIngressAgent(sc *env.ServerConf) (*kubernetes.Agent, error) {
 	if sc.IngressCluster == "kubeconfig" && sc.SelfKubeconfig != "" {
 		agent, err := local.GetSelfAgentFromFileConfig(sc.SelfKubeconfig)
 

+ 4 - 2
api/server/shared/config/metadata.go

@@ -1,5 +1,7 @@
 package config
 
+import "github.com/porter-dev/porter/api/server/shared/config/env"
+
 type Metadata struct {
 	Provisioning       bool `json:"provisioner"`
 	Github             bool `json:"github"`
@@ -11,7 +13,7 @@ type Metadata struct {
 	Analytics          bool `json:"analytics"`
 }
 
-func MetadataFromConf(sc *ServerConf) *Metadata {
+func MetadataFromConf(sc *env.ServerConf) *Metadata {
 	return &Metadata{
 		// TODO: case provisioning on env variables
 		Provisioning:       false,
@@ -25,7 +27,7 @@ func MetadataFromConf(sc *ServerConf) *Metadata {
 	}
 }
 
-func hasGithubAppVars(sc *ServerConf) bool {
+func hasGithubAppVars(sc *env.ServerConf) bool {
 	return sc.GithubAppClientID != "" &&
 		sc.GithubAppClientSecret != "" &&
 		sc.GithubAppName != "" &&

+ 2 - 2
internal/adapter/gorm.go

@@ -4,14 +4,14 @@ import (
 	"fmt"
 	"time"
 
-	"github.com/porter-dev/porter/api/server/shared/config"
+	"github.com/porter-dev/porter/api/server/shared/config/env"
 	"gorm.io/driver/postgres"
 	"gorm.io/driver/sqlite"
 	"gorm.io/gorm"
 )
 
 // New returns a new gorm database instance
-func New(conf *config.DBConf) (*gorm.DB, error) {
+func New(conf *env.DBConf) (*gorm.DB, error) {
 	if conf.SQLLite {
 		// we add DisableForeignKeyConstraintWhenMigrating since our sqlite does
 		// not support foreign key constraints

+ 2 - 2
internal/adapter/redis.go

@@ -5,11 +5,11 @@ import (
 	"fmt"
 
 	redis "github.com/go-redis/redis/v8"
-	"github.com/porter-dev/porter/api/server/shared/config"
+	"github.com/porter-dev/porter/api/server/shared/config/env"
 )
 
 // NewRedisClient returns a new redis client instance
-func NewRedisClient(conf *config.RedisConf) (*redis.Client, error) {
+func NewRedisClient(conf *env.RedisConf) (*redis.Client, error) {
 	client := redis.NewClient(&redis.Options{
 		Addr:     fmt.Sprintf("%s:%s", conf.Host, conf.Port),
 		Username: conf.Username,

+ 2 - 2
internal/auth/sessionstore/sessionstore.go

@@ -11,7 +11,7 @@ import (
 	"github.com/gorilla/securecookie"
 	"github.com/gorilla/sessions"
 
-	"github.com/porter-dev/porter/api/server/shared/config"
+	"github.com/porter-dev/porter/api/server/shared/config/env"
 	"github.com/porter-dev/porter/internal/models"
 	"github.com/porter-dev/porter/internal/repository"
 
@@ -137,7 +137,7 @@ func NewStore(opts *NewStoreOpts) (*PGStore, error) {
 }
 
 // NewFilesystemStore takes session key pairs to create a session-store in the local fs without using a db.
-func NewFilesystemStore(conf config.ServerConf) *sessions.FilesystemStore {
+func NewFilesystemStore(conf env.ServerConf) *sessions.FilesystemStore {
 	keyPairs := [][]byte{}
 
 	for _, key := range conf.CookieSecrets {

+ 15 - 15
internal/kubernetes/agent.go

@@ -12,7 +12,7 @@ import (
 	"io/ioutil"
 	"strings"
 
-	"github.com/porter-dev/porter/api/server/shared/config"
+	"github.com/porter-dev/porter/api/server/shared/config/env"
 	"github.com/porter-dev/porter/internal/kubernetes/provisioner"
 	"github.com/porter-dev/porter/internal/kubernetes/provisioner/aws"
 	"github.com/porter-dev/porter/internal/kubernetes/provisioner/aws/ecr"
@@ -885,8 +885,8 @@ func (a *Agent) ProvisionECR(
 	repo repository.Repository,
 	infra *models.Infra,
 	operation provisioner.ProvisionerOperation,
-	pgConf *config.DBConf,
-	redisConf *config.RedisConf,
+	pgConf *env.DBConf,
+	redisConf *env.RedisConf,
 	provImageTag string,
 	provImagePullSecret string,
 ) (*batchv1.Job, error) {
@@ -922,8 +922,8 @@ func (a *Agent) ProvisionEKS(
 	repo repository.Repository,
 	infra *models.Infra,
 	operation provisioner.ProvisionerOperation,
-	pgConf *config.DBConf,
-	redisConf *config.RedisConf,
+	pgConf *env.DBConf,
+	redisConf *env.RedisConf,
 	provImageTag string,
 	provImagePullSecret string,
 ) (*batchv1.Job, error) {
@@ -959,8 +959,8 @@ func (a *Agent) ProvisionGCR(
 	repo repository.Repository,
 	infra *models.Infra,
 	operation provisioner.ProvisionerOperation,
-	pgConf *config.DBConf,
-	redisConf *config.RedisConf,
+	pgConf *env.DBConf,
+	redisConf *env.RedisConf,
 	provImageTag string,
 	provImagePullSecret string,
 ) (*batchv1.Job, error) {
@@ -993,8 +993,8 @@ func (a *Agent) ProvisionGKE(
 	repo repository.Repository,
 	infra *models.Infra,
 	operation provisioner.ProvisionerOperation,
-	pgConf *config.DBConf,
-	redisConf *config.RedisConf,
+	pgConf *env.DBConf,
+	redisConf *env.RedisConf,
 	provImageTag string,
 	provImagePullSecret string,
 ) (*batchv1.Job, error) {
@@ -1031,8 +1031,8 @@ func (a *Agent) ProvisionDOCR(
 	docrName, docrSubscriptionTier string,
 	infra *models.Infra,
 	operation provisioner.ProvisionerOperation,
-	pgConf *config.DBConf,
-	redisConf *config.RedisConf,
+	pgConf *env.DBConf,
+	redisConf *env.RedisConf,
 	provImageTag string,
 	provImagePullSecret string,
 ) (*batchv1.Job, error) {
@@ -1083,8 +1083,8 @@ func (a *Agent) ProvisionDOKS(
 	doRegion, doksClusterName string,
 	infra *models.Infra,
 	operation provisioner.ProvisionerOperation,
-	pgConf *config.DBConf,
-	redisConf *config.RedisConf,
+	pgConf *env.DBConf,
+	redisConf *env.RedisConf,
 	provImageTag string,
 	provImagePullSecret string,
 ) (*batchv1.Job, error) {
@@ -1132,8 +1132,8 @@ func (a *Agent) ProvisionTest(
 	infra *models.Infra,
 	repo repository.Repository,
 	operation provisioner.ProvisionerOperation,
-	pgConf *config.DBConf,
-	redisConf *config.RedisConf,
+	pgConf *env.DBConf,
+	redisConf *env.RedisConf,
 	provImageTag string,
 	provImagePullSecret string,
 ) (*batchv1.Job, error) {

+ 3 - 3
internal/kubernetes/provisioner/provisioner.go

@@ -7,7 +7,7 @@ import (
 	v1 "k8s.io/api/core/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 
-	"github.com/porter-dev/porter/api/server/shared/config"
+	"github.com/porter-dev/porter/api/server/shared/config/env"
 	"github.com/porter-dev/porter/internal/kubernetes/provisioner/aws"
 	"github.com/porter-dev/porter/internal/kubernetes/provisioner/aws/ecr"
 	"github.com/porter-dev/porter/internal/kubernetes/provisioner/aws/eks"
@@ -40,8 +40,8 @@ type Conf struct {
 	Name                string
 	Namespace           string
 	ID                  string
-	Redis               *config.RedisConf
-	Postgres            *config.DBConf
+	Redis               *env.RedisConf
+	Postgres            *env.DBConf
 	Operation           ProvisionerOperation
 	ProvisionerImageTag string
 	ImagePullSecret     string

+ 2 - 2
internal/repository/gorm/helpers_test.go

@@ -5,7 +5,7 @@ import (
 	"testing"
 	"time"
 
-	"github.com/porter-dev/porter/api/server/shared/config"
+	"github.com/porter-dev/porter/api/server/shared/config/env"
 	"github.com/porter-dev/porter/api/types"
 	"github.com/porter-dev/porter/internal/adapter"
 	"github.com/porter-dev/porter/internal/models"
@@ -39,7 +39,7 @@ type tester struct {
 func setupTestEnv(tester *tester, t *testing.T) {
 	t.Helper()
 
-	db, err := adapter.New(&config.DBConf{
+	db, err := adapter.New(&env.DBConf{
 		EncryptionKey: "__random_strong_encryption_key__",
 		SQLLite:       true,
 		SQLLitePath:   tester.dbFileName,

+ 9 - 8
server/api/api.go

@@ -9,6 +9,7 @@ import (
 	"github.com/go-playground/locales/en"
 	ut "github.com/go-playground/universal-translator"
 	vr "github.com/go-playground/validator/v10"
+	"github.com/porter-dev/porter/api/server/shared/config/env"
 	"github.com/porter-dev/porter/internal/auth/sessionstore"
 	"github.com/porter-dev/porter/internal/auth/token"
 	"github.com/porter-dev/porter/internal/kubernetes/local"
@@ -42,9 +43,9 @@ type AppConfig struct {
 	DB         *gorm.DB
 	Logger     *lr.Logger
 	Repository repository.Repository
-	ServerConf config.ServerConf
-	RedisConf  *config.RedisConf
-	DBConf     config.DBConf
+	ServerConf env.ServerConf
+	RedisConf  *env.RedisConf
+	DBConf     env.DBConf
 	CapConf    config.CapConf
 
 	// TestAgents if API is in testing mode
@@ -55,7 +56,7 @@ type AppConfig struct {
 // and a logger instance
 type App struct {
 	// Server configuration
-	ServerConf config.ServerConf
+	ServerConf env.ServerConf
 
 	// Logger for logging
 	Logger *lr.Logger
@@ -74,10 +75,10 @@ type App struct {
 	IngressAgent     *kubernetes.Agent
 
 	// redis client for redis connection
-	RedisConf *config.RedisConf
+	RedisConf *env.RedisConf
 
 	// config for db
-	DBConf config.DBConf
+	DBConf env.DBConf
 
 	// config for capabilities
 	Capabilities *AppCapabilities
@@ -269,7 +270,7 @@ func New(conf *AppConfig) (*App, error) {
 	return app, nil
 }
 
-func (app *App) assignProvisionerAgent(sc *config.ServerConf) error {
+func (app *App) assignProvisionerAgent(sc *env.ServerConf) error {
 	if sc.ProvisionerCluster == "kubeconfig" && sc.SelfKubeconfig != "" {
 		app.Capabilities.Provisioning = true
 
@@ -299,7 +300,7 @@ func (app *App) assignProvisionerAgent(sc *config.ServerConf) error {
 	return nil
 }
 
-func (app *App) assignIngressAgent(sc *config.ServerConf) error {
+func (app *App) assignIngressAgent(sc *env.ServerConf) error {
 	if sc.IngressCluster == "kubeconfig" && sc.SelfKubeconfig != "" {
 		agent, err := local.GetSelfAgentFromFileConfig(sc.SelfKubeconfig)
 

+ 4 - 4
server/api/helpers_test.go

@@ -8,7 +8,7 @@ import (
 
 	"github.com/go-chi/chi"
 
-	"github.com/porter-dev/porter/api/server/shared/config"
+	"github.com/porter-dev/porter/api/server/shared/config/env"
 	"github.com/porter-dev/porter/api/server/shared/config/loader"
 	"github.com/porter-dev/porter/internal/adapter"
 	"github.com/porter-dev/porter/internal/auth/sessionstore"
@@ -65,7 +65,7 @@ func (t *tester) createUserSession(email string, pw string) {
 
 func newTester(canQuery bool) *tester {
 	appConf := loader.EnvConf{
-		ServerConf: &config.ServerConf{
+		ServerConf: &env.ServerConf{
 			Debug:                true,
 			Port:                 8080,
 			CookieName:           "porter",
@@ -78,12 +78,12 @@ func newTester(canQuery bool) *tester {
 			BasicLoginEnabled:    true,
 		},
 		// unimportant here
-		DBConf: &config.DBConf{},
+		DBConf: &env.DBConf{},
 	}
 
 	logger := lr.NewConsole(appConf.ServerConf.Debug)
 
-	db, _ := adapter.New(&config.DBConf{
+	db, _ := adapter.New(&env.DBConf{
 		EncryptionKey: "__random_strong_encryption_key__",
 		SQLLite:       true,
 		SQLLitePath:   "api_test.db",