Documentation ¶
Index ¶
- Constants
- func GetLegacyURL() (parsed *url.URL)
- func GetProxy(security Security, enforcer libsecurity.Enforcer, ...) []gin.HandlerFunc
- func RegisterRoutes(ctx context.Context, conf config.CanopsisConf, router gin.IRouter, ...)
- func RegisterValidators(client mongo.DbClient)
- func RestartGoroutine(key string, f func(), wg *sync.WaitGroup, logger zerolog.Logger)
- func ReverseProxyHandler() gin.HandlerFunc
- type API
- type Router
- type Security
- type Worker
Constants ¶
View Source
const ( DefaultOldAPI = "localhost:8081" EnvOldApiURL = "CPS_OLD_API_URL" )
Variables ¶
This section is empty.
Functions ¶
func GetLegacyURL ¶
GetLegacyURL returns old API url from env var or default url.
func GetProxy ¶
func GetProxy( security Security, enforcer libsecurity.Enforcer, accessConfig proxy.AccessConfig, ) []gin.HandlerFunc
func RegisterRoutes ¶
func RegisterRoutes( ctx context.Context, conf config.CanopsisConf, router gin.IRouter, security Security, enforcer libsecurity.Enforcer, dbClient mongo.DbClient, timezoneConfigProvider config.TimezoneConfigProvider, pbhStore redis.Store, pbhService libpbehavior.Service, pbhComputeChan chan<- libpbehavior.ComputeTask, entityPublChan chan<- libentityservice.ChangeEntityMessage, runInfoManager engine.RunInfoManager, exportExecutor export.TaskExecutor, actionLogger logger.ActionLogger, publisher amqp.Publisher, jobQueue contextgraph.JobQueue, userInterfaceConfig config.UserInterfaceConfigProvider, logger zerolog.Logger, )
func RegisterValidators ¶
func RestartGoroutine ¶
RestartGoroutine starts goroutine with panic recovery. RestartGoroutine logs recovery and restarts goroutine on panic.
func ReverseProxyHandler ¶
func ReverseProxyHandler() gin.HandlerFunc
ReverseProxyHandler directs requests to old API. It doesn't support old API session and uses auth api key for authentication.
Types ¶
type API ¶
type API interface { // Run starts http server. Run(context.Context) error // AddRouter adds new router. AddRouter(Router) // AddWorker adds new worker. AddWorker(string, Worker) // AddNoRoute adds handlers for no roure. AddNoRoute([]gin.HandlerFunc) }
API is used to implement API http server.
type Security ¶
type Security interface { // GetHttpAuthProviders creates http providers which authenticates each API request. GetHttpAuthProviders() []libsecurity.HttpProvider // GetAuthProviders creates providers which are used in auth API request. GetAuthProviders() []libsecurity.Provider // RegisterCallbackRoutes registers callback routes for auth methods. RegisterCallbackRoutes(router gin.IRouter) GetAuthMiddleware() []gin.HandlerFunc GetSessionStore() libsession.Store GetConfig() libsecurity.Config GetPasswordEncoder() password.Encoder }
Security is used to init auth methods by config.
func NewSecurity ¶
func NewSecurity( config *libsecurity.Config, dbClient mongo.DbClient, sessionStore libsession.Store, logger zerolog.Logger, ) Security
NewSecurity creates new security.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.