first commit
This commit is contained in:
commit
3ca46c9ea2
19 changed files with 958 additions and 0 deletions
24
umami_token.go
Normal file
24
umami_token.go
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
package traefik_umami_feeder
|
||||
|
||||
type Auth struct {
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
}
|
||||
|
||||
type AuthResponse struct {
|
||||
Token string `json:"token"`
|
||||
}
|
||||
|
||||
func getToken(umamiHost string, umamiUsername string, umamiPassword string) (string, error) {
|
||||
var result AuthResponse
|
||||
err := sendRequestAndParse(umamiHost+"/api/auth/login", Auth{
|
||||
Username: umamiUsername,
|
||||
Password: umamiPassword,
|
||||
}, nil, &result)
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return result.Token, nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue