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