fix: agent setup config
This commit is contained in:
parent
32ef0a140e
commit
9020e691de
|
@ -1,10 +1,10 @@
|
|||
package config
|
||||
|
||||
const LastCommitLog = "N/A"
|
||||
const BuildDate = "N/A"
|
||||
const LastCommitLog = "48882e67badf2813406d1b9bdc65c20f22c0f8fd"
|
||||
const BuildDate = "2024-03-20T02:20:55Z"
|
||||
|
||||
const EOLDate = "N/A"
|
||||
const EOLDate = "2024-12-31T10:10:10Z"
|
||||
|
||||
const Version = "0.0.1-SNAPSHOT"
|
||||
const Version = "1.0.0_SNAPSHOT"
|
||||
|
||||
const BuildNumber = "001"
|
||||
const BuildNumber = "001"
|
||||
|
|
|
@ -52,15 +52,15 @@ pipeline:
|
|||
Content-Type: application/json
|
||||
body: $[[message]]
|
||||
basic_auth:
|
||||
username: ingest
|
||||
password: password
|
||||
username: $[[SETUP_ES_USERNAME]]
|
||||
password: $[[SETUP_ES_PASSWORD]]
|
||||
# tls: #for mTLS connection with config servers
|
||||
# enabled: true
|
||||
# ca_file: /xxx/ca.crt
|
||||
# cert_file: /xxx/client.crt
|
||||
# key_file: /xxx/client.key
|
||||
# skip_insecure_verify: false
|
||||
schema: "http"
|
||||
schema: "$[[SETUP_SCHEME]]"
|
||||
hosts: # receiver endpoint, fallback in order
|
||||
- "$[[SETUP_ENDPOINT]]"
|
||||
valid_status_code: [200,201] #panic on other status code
|
|
@ -6,6 +6,15 @@ import (
|
|||
"crypto/md5"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
uri2 "net/url"
|
||||
"path"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
log "github.com/cihub/seelog"
|
||||
"github.com/valyala/fasttemplate"
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
|
@ -33,14 +42,6 @@ import (
|
|||
"infini.sh/framework/modules/security"
|
||||
_ "infini.sh/framework/modules/security"
|
||||
"infini.sh/framework/plugins/replay"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
uri2 "net/url"
|
||||
"path"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Module struct {
|
||||
|
@ -756,8 +757,14 @@ func (module *Module) initializeTemplate(w http.ResponseWriter, r *http.Request,
|
|||
tpl, err = fasttemplate.NewTemplate(output, "$[[", "]]")
|
||||
output = tpl.ExecuteFuncString(func(w io.Writer, tag string) (int, error) {
|
||||
switch tag {
|
||||
case "SETUP_ES_USERNAME":
|
||||
return w.Write([]byte(request.Cluster.Username))
|
||||
case "SETUP_ES_PASSWORD":
|
||||
return w.Write([]byte(request.Cluster.Password))
|
||||
case "SETUP_SCHEME":
|
||||
return w.Write([]byte(strings.Split(request.Cluster.Endpoint, "://")[0]))
|
||||
case "SETUP_ENDPOINT":
|
||||
return w.Write([]byte(request.Cluster.Endpoint))
|
||||
return w.Write([]byte(strings.Split(request.Cluster.Endpoint, "://")[1]))
|
||||
case "SETUP_TEMPLATE_NAME":
|
||||
return w.Write([]byte(cfg1.TemplateName))
|
||||
case "SETUP_INDEX_PREFIX":
|
||||
|
|
Loading…
Reference in New Issue