success write tokens to config with toml (not finish)

This commit is contained in:
2023-09-15 19:09:20 +08:00
parent 7e09934024
commit 856bb3e27b
8 changed files with 39 additions and 33 deletions

View File

@@ -39,7 +39,7 @@ type HTTPError struct {
type Config struct {
Common CommonInfo
Tokens []TokenInfo
Tokens
}
type CommonInfo struct {
@@ -58,6 +58,10 @@ type CommonInfo struct {
DashboardTls bool
}
type Tokens struct {
Tokens map[string]TokenInfo `toml:"tokens"`
}
type TokenInfo struct {
User string `toml:"user" json:"user" form:"user"`
Token string `toml:"token" json:"token" form:"token"`
@@ -112,3 +116,9 @@ type TokenEnable struct {
func (e *HTTPError) Error() string {
return e.Err.Error()
}
func (c *HandleController) TokensList() Tokens {
return Tokens{
c.Tokens,
}
}