mirror of
https://github.com/documize/community.git
synced 2025-08-05 05:25:27 +02:00
set defaults for request context
This commit is contained in:
parent
63b24aed3f
commit
8081b60146
23 changed files with 692 additions and 666 deletions
|
@ -25,16 +25,19 @@ import (
|
|||
)
|
||||
|
||||
func clientID(ctx domain.RequestContext, s *domain.Store) string {
|
||||
return s.Setting.Get(meta.ConfigHandle(), "clientID")
|
||||
c, _ := s.Setting.Get(meta.ConfigHandle(), "clientID")
|
||||
return c
|
||||
}
|
||||
|
||||
func clientSecret(ctx domain.RequestContext, s *domain.Store) string {
|
||||
return s.Setting.Get(meta.ConfigHandle(), "clientSecret")
|
||||
c, _ := s.Setting.Get(meta.ConfigHandle(), "clientSecret")
|
||||
return c
|
||||
}
|
||||
|
||||
func authorizationCallbackURL(ctx domain.RequestContext, s *domain.Store) string {
|
||||
// NOTE: URL value must have the path and query "/api/public/validate?section=github"
|
||||
return s.Setting.Get(meta.ConfigHandle(), "authorizationCallbackURL")
|
||||
c, _ := s.Setting.Get(meta.ConfigHandle(), "authorizationCallbackURL")
|
||||
return c
|
||||
}
|
||||
|
||||
func validateToken(ctx provider.Context, s *domain.Store, ptoken string) error {
|
||||
|
|
|
@ -222,7 +222,9 @@ func (c *Context) MarshalSecrets(sec interface{}, s *domain.Store) error {
|
|||
// Errors return the empty string.
|
||||
func (c *Context) GetSecrets(JSONpath string, s *domain.Store) string {
|
||||
m := c.prov.Meta()
|
||||
return s.Setting.GetUser(c.OrgID, c.UserID, m.ContentType, JSONpath)
|
||||
v, _ := s.Setting.GetUser(c.OrgID, c.UserID, m.ContentType, JSONpath)
|
||||
|
||||
return v
|
||||
}
|
||||
|
||||
// ErrNoSecrets is returned if no secret is found in the database.
|
||||
|
|
|
@ -69,7 +69,7 @@ func (p *Provider) Command(ctx *provider.Context, w http.ResponseWriter, r *http
|
|||
}
|
||||
|
||||
config.Clean()
|
||||
config.AppKey = p.Store.Setting.Get(meta.ConfigHandle(), "appKey")
|
||||
config.AppKey, _ = p.Store.Setting.Get(meta.ConfigHandle(), "appKey")
|
||||
|
||||
if len(config.AppKey) == 0 {
|
||||
p.Runtime.Log.Info("missing trello App Key")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue