fix(server): dynamodb tests + provider config
This commit is contained in:
@@ -57,7 +57,7 @@ func InitMemStore() error {
|
||||
}
|
||||
|
||||
redisURL := requiredEnvs.RedisURL
|
||||
if redisURL != "" && !requiredEnvs.disableRedisForEnv {
|
||||
if redisURL != "" && !requiredEnvs.DisableRedisForEnv {
|
||||
log.Info("Initializing Redis memory store")
|
||||
Provider, err = redis.NewRedisProvider(redisURL)
|
||||
if err != nil {
|
||||
|
@@ -27,7 +27,11 @@ type RequiredEnv struct {
|
||||
DatabaseCertKey string `json:"DATABASE_CERT_KEY"`
|
||||
DatabaseCACert string `json:"DATABASE_CA_CERT"`
|
||||
RedisURL string `json:"REDIS_URL"`
|
||||
disableRedisForEnv bool `json:"DISABLE_REDIS_FOR_ENV"`
|
||||
DisableRedisForEnv bool `json:"DISABLE_REDIS_FOR_ENV"`
|
||||
// AWS Related Envs
|
||||
AwsRegion string `json:"AWS_REGION"`
|
||||
AwsAccessKeyID string `json:"AWS_ACCESS_KEY_ID"`
|
||||
AwsSecretAccessKey string `json:"AWS_SECRET_ACCESS_KEY"`
|
||||
}
|
||||
|
||||
// RequiredEnvObj is a simple in-memory store for sessions.
|
||||
@@ -53,7 +57,8 @@ func (r *RequiredEnvStore) SetRequiredEnv(requiredEnv RequiredEnv) {
|
||||
|
||||
var RequiredEnvStoreObj *RequiredEnvStore
|
||||
|
||||
// InitRequiredEnv to initialize EnvData and through error if required env are not present
|
||||
// InitRequiredEnv to initialize EnvData and throw error if required env are not present
|
||||
// This includes env that only configurable via env vars and not the ui
|
||||
func InitRequiredEnv() error {
|
||||
envPath := os.Getenv(constants.EnvKeyEnvPath)
|
||||
|
||||
@@ -85,6 +90,9 @@ func InitRequiredEnv() error {
|
||||
dbCACert := os.Getenv(constants.EnvKeyDatabaseCACert)
|
||||
redisURL := os.Getenv(constants.EnvKeyRedisURL)
|
||||
disableRedisForEnv := os.Getenv(constants.EnvKeyDisableRedisForEnv) == "true"
|
||||
awsRegion := os.Getenv(constants.EnvAwsRegion)
|
||||
awsAccessKeyID := os.Getenv(constants.EnvAwsAccessKeyID)
|
||||
awsSecretAccessKey := os.Getenv(constants.EnvAwsSecretAccessKey)
|
||||
|
||||
if strings.TrimSpace(redisURL) == "" {
|
||||
if cli.ARG_REDIS_URL != nil && *cli.ARG_REDIS_URL != "" {
|
||||
@@ -139,7 +147,10 @@ func InitRequiredEnv() error {
|
||||
DatabaseCertKey: dbCertKey,
|
||||
DatabaseCACert: dbCACert,
|
||||
RedisURL: redisURL,
|
||||
disableRedisForEnv: disableRedisForEnv,
|
||||
DisableRedisForEnv: disableRedisForEnv,
|
||||
AwsRegion: awsRegion,
|
||||
AwsAccessKeyID: awsAccessKeyID,
|
||||
AwsSecretAccessKey: awsSecretAccessKey,
|
||||
}
|
||||
|
||||
RequiredEnvStoreObj = &RequiredEnvStore{
|
||||
|
Reference in New Issue
Block a user