chore: formatting
This commit is contained in:
parent
af6421da88
commit
7c4154a459
6 changed files with 9 additions and 9 deletions
|
|
@ -28,8 +28,8 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
configFile = "/etc/hivemind/config.toml"
|
configFile = "/etc/hivemind/config.toml"
|
||||||
registryFile = "/var/lib/hivemind/registry"
|
registryFile = "/var/lib/hivemind/registry"
|
||||||
)
|
)
|
||||||
|
|
||||||
func levelToZerolog(l config.LogLevel) zerolog.Level {
|
func levelToZerolog(l config.LogLevel) zerolog.Level {
|
||||||
|
|
|
||||||
|
|
@ -44,4 +44,3 @@ func (c *MasterConfig) Merge(other MasterConfig) {
|
||||||
c.BackoffCount = other.BackoffCount
|
c.BackoffCount = other.BackoffCount
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,8 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type FileStorage struct {
|
type FileStorage struct {
|
||||||
filename string
|
filename string
|
||||||
lock sync.Mutex
|
lock sync.Mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewFileStorage(filename string) *FileStorage {
|
func NewFileStorage(filename string) *FileStorage {
|
||||||
|
|
@ -31,7 +31,7 @@ func (fs *FileStorage) EnsureExists() {
|
||||||
if _, err := os.Stat(fs.filename); os.IsNotExist(err) {
|
if _, err := os.Stat(fs.filename); os.IsNotExist(err) {
|
||||||
fs.Save(&storedConfig{
|
fs.Save(&storedConfig{
|
||||||
LastUpdate: time.Now().UnixMilli(),
|
LastUpdate: time.Now().UnixMilli(),
|
||||||
Nodes: make(map[string]types.Node),
|
Nodes: make(map[string]types.Node),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,6 @@ type RuntimeState struct {
|
||||||
func New(r *registry.Registry, n types.Node) *RuntimeState {
|
func New(r *registry.Registry, n types.Node) *RuntimeState {
|
||||||
return &RuntimeState{
|
return &RuntimeState{
|
||||||
Registry: r,
|
Registry: r,
|
||||||
Self: n,
|
Self: n,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,6 @@ package types
|
||||||
|
|
||||||
type HostState struct {
|
type HostState struct {
|
||||||
Domains []string
|
Domains []string
|
||||||
Address string
|
Address string
|
||||||
Hostname string
|
Hostname string
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ type client struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
var defaultClient *client
|
var defaultClient *client
|
||||||
|
|
||||||
const timeout = time.Duration(2) * time.Second
|
const timeout = time.Duration(2) * time.Second
|
||||||
|
|
||||||
func (c *client) makeRequest(method string, host string, path types.Path, data any, out any) error {
|
func (c *client) makeRequest(method string, host string, path types.Path, data any, out any) error {
|
||||||
|
|
@ -78,7 +79,7 @@ func Init(mw middleware.Middleware) {
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultClient = &client{
|
defaultClient = &client{
|
||||||
http: &http.Client{
|
http: &http.Client{
|
||||||
Timeout: timeout,
|
Timeout: timeout,
|
||||||
},
|
},
|
||||||
middleware: mw,
|
middleware: mw,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue