fix: import cycle issues

This commit is contained in:
Lakhan Samani
2022-05-30 11:54:16 +05:30
parent 1146468a03
commit 7e3bd6a721
37 changed files with 349 additions and 239 deletions

View File

@@ -2,8 +2,6 @@ package inmemory
import (
"strings"
"github.com/authorizerdev/authorizer/server/utils"
)
// ClearStore clears the in-memory store.
@@ -105,6 +103,12 @@ func (c *provider) GetBoolStoreEnvVariable(key string) (bool, error) {
// GetSliceStoreEnvVariable to get the env variable from slice store object
func (c *provider) GetSliceStoreEnvVariable(key string) ([]string, error) {
res := c.envStore.Get(key)
resSlice := utils.ConvertInterfaceToStringSlice(res)
data := res.([]interface{})
var resSlice []string
for _, v := range data {
resSlice = append(resSlice, v.(string))
}
return resSlice, nil
}

View File

@@ -9,8 +9,8 @@ import (
"github.com/joho/godotenv"
log "github.com/sirupsen/logrus"
"github.com/authorizerdev/authorizer/server/cli"
"github.com/authorizerdev/authorizer/server/constants"
"github.com/authorizerdev/authorizer/server/utils"
)
// RequiredEnv holds information about required envs
@@ -62,8 +62,8 @@ func InitRequiredEnv() error {
}
}
if utils.ARG_ENV_FILE != nil && *utils.ARG_ENV_FILE != "" {
envPath = *utils.ARG_ENV_FILE
if cli.ARG_ENV_FILE != nil && *cli.ARG_ENV_FILE != "" {
envPath = *cli.ARG_ENV_FILE
}
log.Info("env path: ", envPath)
@@ -85,8 +85,8 @@ func InitRequiredEnv() error {
redisURL := os.Getenv(constants.EnvKeyRedisURL)
if strings.TrimSpace(dbType) == "" {
if utils.ARG_DB_TYPE != nil && *utils.ARG_DB_TYPE != "" {
dbType = strings.TrimSpace(*utils.ARG_DB_TYPE)
if cli.ARG_DB_TYPE != nil && *cli.ARG_DB_TYPE != "" {
dbType = strings.TrimSpace(*cli.ARG_DB_TYPE)
}
if dbType == "" {
@@ -96,8 +96,8 @@ func InitRequiredEnv() error {
}
if strings.TrimSpace(dbURL) == "" {
if utils.ARG_DB_URL != nil && *utils.ARG_DB_URL != "" {
dbURL = strings.TrimSpace(*utils.ARG_DB_URL)
if cli.ARG_DB_URL != nil && *cli.ARG_DB_URL != "" {
dbURL = strings.TrimSpace(*cli.ARG_DB_URL)
}
if dbURL == "" && dbPort == "" && dbHost == "" && dbUsername == "" && dbPassword == "" {