mirror of
https://github.com/TecharoHQ/anubis.git
synced 2026-04-19 06:44:58 +00:00
refactor: move cel environment creation to a subpackage
Signed-off-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/TecharoHQ/anubis/internal"
|
||||
"github.com/TecharoHQ/anubis/lib/checker/expression/environment"
|
||||
"github.com/TecharoHQ/anubis/lib/policy/expressions"
|
||||
"github.com/google/cel-go/cel"
|
||||
"github.com/google/cel-go/common/types"
|
||||
@@ -17,12 +18,12 @@ type Checker struct {
|
||||
}
|
||||
|
||||
func New(cfg *Config) (*Checker, error) {
|
||||
env, err := expressions.BotEnvironment()
|
||||
env, err := environment.Bot()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
program, err := expressions.Compile(env, cfg.String())
|
||||
program, err := environment.Compile(env, cfg.String())
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("can't compile CEL program: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user