authorizer/server/main.go

36 lines
1.0 KiB
Go
Raw Permalink Normal View History

package main
import (
"flag"
"github.com/authorizerdev/authorizer/server/constants"
2021-07-28 06:23:37 +00:00
"github.com/authorizerdev/authorizer/server/db"
2021-12-20 12:03:11 +00:00
"github.com/authorizerdev/authorizer/server/env"
2022-01-17 06:02:13 +00:00
"github.com/authorizerdev/authorizer/server/envstore"
2021-07-23 16:27:44 +00:00
"github.com/authorizerdev/authorizer/server/oauth"
2022-01-17 06:02:13 +00:00
"github.com/authorizerdev/authorizer/server/routes"
"github.com/authorizerdev/authorizer/server/sessionstore"
)
2021-12-24 12:17:35 +00:00
var VERSION string
func main() {
envstore.ARG_DB_URL = flag.String("database_url", "", "Database connection string")
envstore.ARG_DB_TYPE = flag.String("database_type", "", "Database type, possible values are postgres,mysql,sqlite")
envstore.ARG_ENV_FILE = flag.String("env_file", "", "Env file path")
flag.Parse()
envstore.EnvInMemoryStoreObj.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeyVersion, VERSION)
2021-12-24 12:17:35 +00:00
2021-12-20 12:03:11 +00:00
env.InitEnv()
2021-07-28 06:23:37 +00:00
db.InitDB()
2021-12-31 08:22:10 +00:00
env.PersistEnv()
sessionstore.InitSession()
oauth.InitOAuth()
2022-01-17 06:02:13 +00:00
router := routes.InitRouter()
router.Run(":" + envstore.EnvInMemoryStoreObj.GetStringStoreEnvVariable(constants.EnvKeyPort))
}