user and password as authentication requirements (#87)

* user and password as authentication requirements

* updated README.md
This commit is contained in:
Marco
2023-09-23 11:41:01 +02:00
committed by GitHub
parent 19062c9f41
commit 8bbc8aa35e
5 changed files with 70 additions and 25 deletions

View File

@@ -14,7 +14,8 @@ type serverConfig struct {
DownloadPath string `yaml:"downloadPath"`
DownloaderPath string `yaml:"downloaderPath"`
RequireAuth bool `yaml:"require_auth"`
RPCSecret string `yaml:"rpc_secret"`
Username string `yaml:"username"`
Password string `yaml:"password"`
QueueSize int `yaml:"queue_size"`
}
@@ -22,7 +23,7 @@ type config struct {
cfg serverConfig
}
func (c *config) TryLoadFromFile(filename string) (serverConfig, error) {
func (c *config) LoadFromFile(filename string) (serverConfig, error) {
fd, err := os.Open(filename)
if err != nil {
return serverConfig{}, err
@@ -55,8 +56,12 @@ func (c *config) RequireAuth(value bool) {
c.cfg.RequireAuth = value
}
func (c *config) RPCSecret(secret string) {
c.cfg.RPCSecret = secret
func (c *config) Username(username string) {
c.cfg.Username = username
}
func (c *config) Password(password string) {
c.cfg.Password = password
}
func (c *config) QueueSize(size int) {