Skip to content

Commit

Permalink
Improve implementation around config (#1122)
Browse files Browse the repository at this point in the history
* refactor config

* fix saas config

* feat(config): scanmodule for each server in config.toml

* feat(config): enable to specify containersOnly in config.toml

* add new keys of config.toml to discover.go

* fix summary output, logging
  • Loading branch information
kotakanbe authored Jan 12, 2021
1 parent a67052f commit 0b55f94
Show file tree
Hide file tree
Showing 44 changed files with 1,238 additions and 1,080 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Vuls is a tool created to solve the problems listed above. It has the following
- [RustSec Advisory Database](https://github.com/RustSec/advisory-db)

- WordPress
- [WPVulnDB](https://wpvulndb.com/api)
- [wpscan](https://wpscan.com/api)

### Scan mode

Expand Down
32 changes: 32 additions & 0 deletions config/chatworkconf.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package config

import (
"github.com/asaskevich/govalidator"
"golang.org/x/xerrors"
)

// ChatWorkConf is ChatWork config
type ChatWorkConf struct {
APIToken string `json:"-"`
Room string `json:"-"`
}

// Validate validates configuration
func (c *ChatWorkConf) Validate() (errs []error) {
if !Conf.ToChatWork {
return
}
if len(c.Room) == 0 {
errs = append(errs, xerrors.New("chatWorkConf.room must not be empty"))
}

if len(c.APIToken) == 0 {
errs = append(errs, xerrors.New("chatWorkConf.ApiToken must not be empty"))
}

_, err := govalidator.ValidateStruct(c)
if err != nil {
errs = append(errs, err)
}
return
}
Loading

0 comments on commit 0b55f94

Please sign in to comment.