🍱 change default mode to live

This commit is contained in:
Max Lerebourg
2022-10-11 19:56:14 +02:00
parent d0ba71c0c8
commit 64a117d7b0
3 changed files with 13 additions and 15 deletions
+1 -1
View File
@@ -51,7 +51,7 @@ At each start of synchronisation, the middleware will wait a random number of se
- enable the plugin - enable the plugin
- CrowdsecMode - CrowdsecMode
- string - string
- default: `stream`, expected value are: `none`, `live`, `stream` - default: `live`, expected value are: `none`, `live`, `stream`
- CrowdsecLapiScheme - CrowdsecLapiScheme
- string - string
- default: `http`, expected value are: `http`, `https` - default: `http`, expected value are: `http`, `https`
+1 -1
View File
@@ -45,7 +45,7 @@ type Config struct {
func CreateConfig() *Config { func CreateConfig() *Config {
return &Config{ return &Config{
Enabled: false, Enabled: false,
CrowdsecMode: noneMode, CrowdsecMode: liveMode,
CrowdsecLapiScheme: "http", CrowdsecLapiScheme: "http",
CrowdsecLapiHost: "crowdsec:8080", CrowdsecLapiHost: "crowdsec:8080",
CrowdsecLapiKey: "", CrowdsecLapiKey: "",
+4 -6
View File
@@ -1,22 +1,20 @@
package crowdsec_bouncer_traefik_plugin_test package crowdsec_bouncer_traefik_plugin
import ( import (
"context" "context"
"net/http" "net/http"
"net/http/httptest" "net/http/httptest"
"testing" "testing"
crowdsec_bouncer_traefik_plugin "github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin"
) )
func TestCrowdSec(t *testing.T) { func TestCrowdSec(t *testing.T) {
cfg := crowdsec_bouncer_traefik_plugin.CreateConfig() cfg := CreateConfig()
cfg.CrowdsecLapiKey = "caca" cfg.CrowdsecLapiKey = "test"
ctx := context.Background() ctx := context.Background()
next := http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {}) next := http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {})
handler, err := crowdsec_bouncer_traefik_plugin.New(ctx, next, cfg, "demo-plugin") handler, err := New(ctx, next, cfg, "demo-plugin")
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }