Merge pull request #926 from moonstream-to/access-id-in-path

Access id could be set in URL path
pull/927/head
Sergei Sumarokov 2023-09-28 15:13:34 +03:00 zatwierdzone przez GitHub
commit a8c96e4ca7
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
4 zmienionych plików z 18 dodań i 9 usunięć

Wyświetl plik

@ -305,9 +305,13 @@ func fetchClientAccessFromResources(accessID, authorizationToken string, tsNow i
func extractAccessID(r *http.Request) string {
var accessID string
accessIDHeaders := r.Header[strings.Title(NB_ACCESS_ID_HEADER)]
for _, h := range accessIDHeaders {
accessID = h
urlPathSlice := strings.Split(r.URL.Path, "/")
if len(urlPathSlice) == 5 {
potentialUuid := urlPathSlice[4]
_, uuidParseErr := uuid.Parse(potentialUuid)
if uuidParseErr == nil {
accessID = potentialUuid
}
}
queries := r.URL.Query()
@ -317,6 +321,11 @@ func extractAccessID(r *http.Request) string {
}
}
accessIDHeaders := r.Header[strings.Title(NB_ACCESS_ID_HEADER)]
for _, h := range accessIDHeaders {
accessID = h
}
return accessID
}

Wyświetl plik

@ -1,3 +1,3 @@
package main
var NB_VERSION = "0.2.3"
var NB_VERSION = "0.2.4"

Wyświetl plik

@ -15,8 +15,8 @@ PREFIX_CRIT="${C_RED}[CRIT]${C_RESET} [$(date +%d-%m\ %T)]"
# Main
AWS_DEFAULT_REGION="${AWS_DEFAULT_REGION:-us-east-1}"
APP_DIR="${APP_DIR:-/home/ubuntu/moonstream}"
SECRETS_DIR="${SECRETS_DIR:-/home/ubuntu/moonstream-secrets}"
APP_DIR="${APP_DIR:-/home/ubuntu/api}"
SECRETS_DIR="${SECRETS_DIR:-/home/ubuntu/nodebalancer-secrets}"
PARAMETERS_ENV_PATH="${SECRETS_DIR}/app.env"
SCRIPT_DIR="$(realpath $(dirname $0))"

Wyświetl plik

@ -5,11 +5,11 @@ StartLimitIntervalSec=300
StartLimitBurst=3
[Service]
WorkingDirectory=/home/ubuntu/moonstream/nodebalancer
EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env
WorkingDirectory=/home/ubuntu/api/nodebalancer
EnvironmentFile=/home/ubuntu/nodebalancer-secrets/app.env
Restart=on-failure
RestartSec=15s
ExecStart=/home/ubuntu/moonstream/nodebalancer/nodebalancer server \
ExecStart=/home/ubuntu/api/nodebalancer/nodebalancer server \
-host "${AWS_LOCAL_IPV4}" \
-port 8544 \
-healthcheck \