prod
Esse commit está contido em:
@@ -3,8 +3,8 @@ package config
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"network-topology-discovery/pkg/models"
|
||||
"os"
|
||||
)
|
||||
|
||||
// Config 应用配置
|
||||
@@ -14,16 +14,17 @@ type Config struct {
|
||||
SSH SSHConfig `json:"ssh"`
|
||||
Web WebConfig `json:"web"`
|
||||
Scanner ScannerConfig `json:"scanner"`
|
||||
Auth AuthConfig `json:"auth"`
|
||||
}
|
||||
|
||||
// DeviceConfig 设备配置
|
||||
type DeviceConfig struct {
|
||||
IP string `json:"ip"`
|
||||
IP string `json:"ip"`
|
||||
Type models.DeviceType `json:"type"`
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
KeyFile string `json:"key_file"`
|
||||
Port int `json:"port"`
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
KeyFile string `json:"key_file"`
|
||||
Port int `json:"port"`
|
||||
}
|
||||
|
||||
// SSHConfig SSH配置
|
||||
@@ -39,6 +40,13 @@ type WebConfig struct {
|
||||
Host string `json:"host"`
|
||||
}
|
||||
|
||||
// AuthConfig 认证配置
|
||||
type AuthConfig struct {
|
||||
Enabled bool `json:"enabled"`
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
}
|
||||
|
||||
// ScannerConfig 扫描器配置
|
||||
type ScannerConfig struct {
|
||||
Concurrency int `json:"concurrency"`
|
||||
@@ -122,4 +130,10 @@ func (c *Config) setDefaults() {
|
||||
if c.Scanner.Timeout == 0 {
|
||||
c.Scanner.Timeout = 2
|
||||
}
|
||||
if c.Auth.Enabled && c.Auth.Username == "" {
|
||||
c.Auth.Username = "admin"
|
||||
}
|
||||
if c.Auth.Enabled && c.Auth.Password == "" {
|
||||
c.Auth.Password = "admin"
|
||||
}
|
||||
}
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário