fix: env to return custom access token script
This commit is contained in:
parent
4bc9059b0f
commit
b42cc1549a
|
@ -56,6 +56,10 @@ type ComplexityRoot struct {
|
||||||
AppURL func(childComplexity int) int
|
AppURL func(childComplexity int) int
|
||||||
AuthorizerURL func(childComplexity int) int
|
AuthorizerURL func(childComplexity int) int
|
||||||
CookieName func(childComplexity int) int
|
CookieName func(childComplexity int) int
|
||||||
|
CustomAccessTokenScript func(childComplexity int) int
|
||||||
|
DatabaseName func(childComplexity int) int
|
||||||
|
DatabaseType func(childComplexity int) int
|
||||||
|
DatabaseURL func(childComplexity int) int
|
||||||
DefaultRoles func(childComplexity int) int
|
DefaultRoles func(childComplexity int) int
|
||||||
DisableBasicAuthentication func(childComplexity int) int
|
DisableBasicAuthentication func(childComplexity int) int
|
||||||
DisableEmailVerification func(childComplexity int) int
|
DisableEmailVerification func(childComplexity int) int
|
||||||
|
@ -273,6 +277,34 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
||||||
|
|
||||||
return e.complexity.Env.CookieName(childComplexity), true
|
return e.complexity.Env.CookieName(childComplexity), true
|
||||||
|
|
||||||
|
case "Env.CUSTOM_ACCESS_TOKEN_SCRIPT":
|
||||||
|
if e.complexity.Env.CustomAccessTokenScript == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
return e.complexity.Env.CustomAccessTokenScript(childComplexity), true
|
||||||
|
|
||||||
|
case "Env.DATABASE_NAME":
|
||||||
|
if e.complexity.Env.DatabaseName == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
return e.complexity.Env.DatabaseName(childComplexity), true
|
||||||
|
|
||||||
|
case "Env.DATABASE_TYPE":
|
||||||
|
if e.complexity.Env.DatabaseType == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
return e.complexity.Env.DatabaseType(childComplexity), true
|
||||||
|
|
||||||
|
case "Env.DATABASE_URL":
|
||||||
|
if e.complexity.Env.DatabaseURL == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
return e.complexity.Env.DatabaseURL(childComplexity), true
|
||||||
|
|
||||||
case "Env.DEFAULT_ROLES":
|
case "Env.DEFAULT_ROLES":
|
||||||
if e.complexity.Env.DefaultRoles == nil {
|
if e.complexity.Env.DefaultRoles == nil {
|
||||||
break
|
break
|
||||||
|
@ -1071,6 +1103,10 @@ type ValidJWTResponse {
|
||||||
|
|
||||||
type Env {
|
type Env {
|
||||||
ADMIN_SECRET: String
|
ADMIN_SECRET: String
|
||||||
|
DATABASE_NAME: String
|
||||||
|
DATABASE_URL: String
|
||||||
|
DATABASE_TYPE: String
|
||||||
|
CUSTOM_ACCESS_TOKEN_SCRIPT: String
|
||||||
SMTP_HOST: String
|
SMTP_HOST: String
|
||||||
SMTP_PORT: String
|
SMTP_PORT: String
|
||||||
SMTP_USERNAME: String
|
SMTP_USERNAME: String
|
||||||
|
@ -1104,6 +1140,7 @@ type Env {
|
||||||
|
|
||||||
input UpdateEnvInput {
|
input UpdateEnvInput {
|
||||||
ADMIN_SECRET: String
|
ADMIN_SECRET: String
|
||||||
|
CUSTOM_ACCESS_TOKEN_SCRIPT: String
|
||||||
OLD_ADMIN_SECRET: String
|
OLD_ADMIN_SECRET: String
|
||||||
SMTP_HOST: String
|
SMTP_HOST: String
|
||||||
SMTP_PORT: String
|
SMTP_PORT: String
|
||||||
|
@ -1710,6 +1747,134 @@ func (ec *executionContext) _Env_ADMIN_SECRET(ctx context.Context, field graphql
|
||||||
return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
|
return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) _Env_DATABASE_NAME(ctx context.Context, field graphql.CollectedField, obj *model.Env) (ret graphql.Marshaler) {
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
ec.Error(ctx, ec.Recover(ctx, r))
|
||||||
|
ret = graphql.Null
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
fc := &graphql.FieldContext{
|
||||||
|
Object: "Env",
|
||||||
|
Field: field,
|
||||||
|
Args: nil,
|
||||||
|
IsMethod: false,
|
||||||
|
IsResolver: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx = graphql.WithFieldContext(ctx, fc)
|
||||||
|
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||||
|
ctx = rctx // use context from middleware stack in children
|
||||||
|
return obj.DatabaseName, nil
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
ec.Error(ctx, err)
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
if resTmp == nil {
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
res := resTmp.(*string)
|
||||||
|
fc.Result = res
|
||||||
|
return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) _Env_DATABASE_URL(ctx context.Context, field graphql.CollectedField, obj *model.Env) (ret graphql.Marshaler) {
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
ec.Error(ctx, ec.Recover(ctx, r))
|
||||||
|
ret = graphql.Null
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
fc := &graphql.FieldContext{
|
||||||
|
Object: "Env",
|
||||||
|
Field: field,
|
||||||
|
Args: nil,
|
||||||
|
IsMethod: false,
|
||||||
|
IsResolver: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx = graphql.WithFieldContext(ctx, fc)
|
||||||
|
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||||
|
ctx = rctx // use context from middleware stack in children
|
||||||
|
return obj.DatabaseURL, nil
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
ec.Error(ctx, err)
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
if resTmp == nil {
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
res := resTmp.(*string)
|
||||||
|
fc.Result = res
|
||||||
|
return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) _Env_DATABASE_TYPE(ctx context.Context, field graphql.CollectedField, obj *model.Env) (ret graphql.Marshaler) {
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
ec.Error(ctx, ec.Recover(ctx, r))
|
||||||
|
ret = graphql.Null
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
fc := &graphql.FieldContext{
|
||||||
|
Object: "Env",
|
||||||
|
Field: field,
|
||||||
|
Args: nil,
|
||||||
|
IsMethod: false,
|
||||||
|
IsResolver: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx = graphql.WithFieldContext(ctx, fc)
|
||||||
|
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||||
|
ctx = rctx // use context from middleware stack in children
|
||||||
|
return obj.DatabaseType, nil
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
ec.Error(ctx, err)
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
if resTmp == nil {
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
res := resTmp.(*string)
|
||||||
|
fc.Result = res
|
||||||
|
return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) _Env_CUSTOM_ACCESS_TOKEN_SCRIPT(ctx context.Context, field graphql.CollectedField, obj *model.Env) (ret graphql.Marshaler) {
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
ec.Error(ctx, ec.Recover(ctx, r))
|
||||||
|
ret = graphql.Null
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
fc := &graphql.FieldContext{
|
||||||
|
Object: "Env",
|
||||||
|
Field: field,
|
||||||
|
Args: nil,
|
||||||
|
IsMethod: false,
|
||||||
|
IsResolver: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx = graphql.WithFieldContext(ctx, fc)
|
||||||
|
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||||
|
ctx = rctx // use context from middleware stack in children
|
||||||
|
return obj.CustomAccessTokenScript, nil
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
ec.Error(ctx, err)
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
if resTmp == nil {
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
res := resTmp.(*string)
|
||||||
|
fc.Result = res
|
||||||
|
return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
|
||||||
|
}
|
||||||
|
|
||||||
func (ec *executionContext) _Env_SMTP_HOST(ctx context.Context, field graphql.CollectedField, obj *model.Env) (ret graphql.Marshaler) {
|
func (ec *executionContext) _Env_SMTP_HOST(ctx context.Context, field graphql.CollectedField, obj *model.Env) (ret graphql.Marshaler) {
|
||||||
defer func() {
|
defer func() {
|
||||||
if r := recover(); r != nil {
|
if r := recover(); r != nil {
|
||||||
|
@ -6361,6 +6526,14 @@ func (ec *executionContext) unmarshalInputUpdateEnvInput(ctx context.Context, ob
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return it, err
|
return it, err
|
||||||
}
|
}
|
||||||
|
case "CUSTOM_ACCESS_TOKEN_SCRIPT":
|
||||||
|
var err error
|
||||||
|
|
||||||
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("CUSTOM_ACCESS_TOKEN_SCRIPT"))
|
||||||
|
it.CustomAccessTokenScript, err = ec.unmarshalOString2ᚖstring(ctx, v)
|
||||||
|
if err != nil {
|
||||||
|
return it, err
|
||||||
|
}
|
||||||
case "OLD_ADMIN_SECRET":
|
case "OLD_ADMIN_SECRET":
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
|
@ -6898,6 +7071,14 @@ func (ec *executionContext) _Env(ctx context.Context, sel ast.SelectionSet, obj
|
||||||
out.Values[i] = graphql.MarshalString("Env")
|
out.Values[i] = graphql.MarshalString("Env")
|
||||||
case "ADMIN_SECRET":
|
case "ADMIN_SECRET":
|
||||||
out.Values[i] = ec._Env_ADMIN_SECRET(ctx, field, obj)
|
out.Values[i] = ec._Env_ADMIN_SECRET(ctx, field, obj)
|
||||||
|
case "DATABASE_NAME":
|
||||||
|
out.Values[i] = ec._Env_DATABASE_NAME(ctx, field, obj)
|
||||||
|
case "DATABASE_URL":
|
||||||
|
out.Values[i] = ec._Env_DATABASE_URL(ctx, field, obj)
|
||||||
|
case "DATABASE_TYPE":
|
||||||
|
out.Values[i] = ec._Env_DATABASE_TYPE(ctx, field, obj)
|
||||||
|
case "CUSTOM_ACCESS_TOKEN_SCRIPT":
|
||||||
|
out.Values[i] = ec._Env_CUSTOM_ACCESS_TOKEN_SCRIPT(ctx, field, obj)
|
||||||
case "SMTP_HOST":
|
case "SMTP_HOST":
|
||||||
out.Values[i] = ec._Env_SMTP_HOST(ctx, field, obj)
|
out.Values[i] = ec._Env_SMTP_HOST(ctx, field, obj)
|
||||||
case "SMTP_PORT":
|
case "SMTP_PORT":
|
||||||
|
|
|
@ -23,6 +23,10 @@ type DeleteUserInput struct {
|
||||||
|
|
||||||
type Env struct {
|
type Env struct {
|
||||||
AdminSecret *string `json:"ADMIN_SECRET"`
|
AdminSecret *string `json:"ADMIN_SECRET"`
|
||||||
|
DatabaseName *string `json:"DATABASE_NAME"`
|
||||||
|
DatabaseURL *string `json:"DATABASE_URL"`
|
||||||
|
DatabaseType *string `json:"DATABASE_TYPE"`
|
||||||
|
CustomAccessTokenScript *string `json:"CUSTOM_ACCESS_TOKEN_SCRIPT"`
|
||||||
SMTPHost *string `json:"SMTP_HOST"`
|
SMTPHost *string `json:"SMTP_HOST"`
|
||||||
SMTPPort *string `json:"SMTP_PORT"`
|
SMTPPort *string `json:"SMTP_PORT"`
|
||||||
SMTPUsername *string `json:"SMTP_USERNAME"`
|
SMTPUsername *string `json:"SMTP_USERNAME"`
|
||||||
|
@ -125,6 +129,7 @@ type SignUpInput struct {
|
||||||
|
|
||||||
type UpdateEnvInput struct {
|
type UpdateEnvInput struct {
|
||||||
AdminSecret *string `json:"ADMIN_SECRET"`
|
AdminSecret *string `json:"ADMIN_SECRET"`
|
||||||
|
CustomAccessTokenScript *string `json:"CUSTOM_ACCESS_TOKEN_SCRIPT"`
|
||||||
OldAdminSecret *string `json:"OLD_ADMIN_SECRET"`
|
OldAdminSecret *string `json:"OLD_ADMIN_SECRET"`
|
||||||
SMTPHost *string `json:"SMTP_HOST"`
|
SMTPHost *string `json:"SMTP_HOST"`
|
||||||
SMTPPort *string `json:"SMTP_PORT"`
|
SMTPPort *string `json:"SMTP_PORT"`
|
||||||
|
|
|
@ -69,6 +69,10 @@ type ValidJWTResponse {
|
||||||
|
|
||||||
type Env {
|
type Env {
|
||||||
ADMIN_SECRET: String
|
ADMIN_SECRET: String
|
||||||
|
DATABASE_NAME: String
|
||||||
|
DATABASE_URL: String
|
||||||
|
DATABASE_TYPE: String
|
||||||
|
CUSTOM_ACCESS_TOKEN_SCRIPT: String
|
||||||
SMTP_HOST: String
|
SMTP_HOST: String
|
||||||
SMTP_PORT: String
|
SMTP_PORT: String
|
||||||
SMTP_USERNAME: String
|
SMTP_USERNAME: String
|
||||||
|
@ -102,6 +106,7 @@ type Env {
|
||||||
|
|
||||||
input UpdateEnvInput {
|
input UpdateEnvInput {
|
||||||
ADMIN_SECRET: String
|
ADMIN_SECRET: String
|
||||||
|
CUSTOM_ACCESS_TOKEN_SCRIPT: String
|
||||||
OLD_ADMIN_SECRET: String
|
OLD_ADMIN_SECRET: String
|
||||||
SMTP_HOST: String
|
SMTP_HOST: String
|
||||||
SMTP_PORT: String
|
SMTP_PORT: String
|
||||||
|
|
|
@ -28,6 +28,10 @@ func EnvResolver(ctx context.Context) (*model.Env, error) {
|
||||||
// get clone of store
|
// get clone of store
|
||||||
store := envstore.EnvInMemoryStoreObj.GetEnvStoreClone()
|
store := envstore.EnvInMemoryStoreObj.GetEnvStoreClone()
|
||||||
adminSecret := store.StringEnv[constants.EnvKeyAdminSecret]
|
adminSecret := store.StringEnv[constants.EnvKeyAdminSecret]
|
||||||
|
databaseURL := store.StringEnv[constants.EnvKeyDatabaseURL]
|
||||||
|
databaseName := store.StringEnv[constants.EnvKeyDatabaseName]
|
||||||
|
databaseType := store.StringEnv[constants.EnvKeyDatabaseType]
|
||||||
|
customAccessTokenScript := store.StringEnv[constants.EnvKeyCustomAccessTokenScript]
|
||||||
smtpHost := store.StringEnv[constants.EnvKeySmtpHost]
|
smtpHost := store.StringEnv[constants.EnvKeySmtpHost]
|
||||||
smtpPort := store.StringEnv[constants.EnvKeySmtpPort]
|
smtpPort := store.StringEnv[constants.EnvKeySmtpPort]
|
||||||
smtpUsername := store.StringEnv[constants.EnvKeySmtpUsername]
|
smtpUsername := store.StringEnv[constants.EnvKeySmtpUsername]
|
||||||
|
@ -60,6 +64,10 @@ func EnvResolver(ctx context.Context) (*model.Env, error) {
|
||||||
|
|
||||||
res = &model.Env{
|
res = &model.Env{
|
||||||
AdminSecret: &adminSecret,
|
AdminSecret: &adminSecret,
|
||||||
|
DatabaseName: &databaseName,
|
||||||
|
DatabaseURL: &databaseURL,
|
||||||
|
DatabaseType: &databaseType,
|
||||||
|
CustomAccessTokenScript: &customAccessTokenScript,
|
||||||
SMTPHost: &smtpHost,
|
SMTPHost: &smtpHost,
|
||||||
SMTPPort: &smtpPort,
|
SMTPPort: &smtpPort,
|
||||||
SMTPPassword: &smtpPassword,
|
SMTPPassword: &smtpPassword,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user