54 lines
901 B
Go
54 lines
901 B
Go
package config
|
||
|
||
import (
|
||
"github.com/google/uuid"
|
||
"sync"
|
||
"time"
|
||
)
|
||
|
||
const (
|
||
ContextKeyUser = "user"
|
||
ContextKeySession = "session_data"
|
||
)
|
||
|
||
var (
|
||
Local = "storage"
|
||
LogsDirectory string
|
||
DirData string
|
||
|
||
Storage AuthStorage
|
||
|
||
JwtSecretKey = []byte(uuid.NewString())
|
||
SessionStore sync.Map
|
||
SessionFile = "sessions.json"
|
||
)
|
||
|
||
type (
|
||
AuthStorage struct {
|
||
Users map[string]User
|
||
}
|
||
|
||
User struct {
|
||
Email string
|
||
Name string
|
||
Password string
|
||
}
|
||
)
|
||
|
||
// ///////////////// в handlers?
|
||
// Работа с файлом (дополнительная опция)
|
||
type (
|
||
FileSession struct {
|
||
ID string `json:"id"`
|
||
Data *SessionData `json:"data"`
|
||
}
|
||
|
||
SessionData struct {
|
||
Proto string `json:"proto"`
|
||
FileName string `json:"file_name"`
|
||
IP string `json:"ip"`
|
||
Token string `json:"token"`
|
||
LastCheck time.Time `json:"last_check"`
|
||
}
|
||
)
|