mirror of
https://github.com/bettercap/bettercap
synced 2025-07-07 13:32:07 -07:00
refact: refactored module status checks in Configure methods for consistency
This commit is contained in:
parent
a8e6b497a3
commit
1e7d99433e
13 changed files with 52 additions and 53 deletions
|
@ -113,7 +113,9 @@ func (api *RestAPI) Configure() error {
|
|||
var ip string
|
||||
var port int
|
||||
|
||||
if err, ip = api.StringParam("api.rest.address"); err != nil {
|
||||
if api.Running() {
|
||||
return session.ErrAlreadyStarted
|
||||
} else if err, ip = api.StringParam("api.rest.address"); err != nil {
|
||||
return err
|
||||
} else if err, port = api.IntParam("api.rest.port"); err != nil {
|
||||
return err
|
||||
|
@ -155,9 +157,7 @@ func (api *RestAPI) Configure() error {
|
|||
}
|
||||
|
||||
func (api *RestAPI) Start() error {
|
||||
if api.Running() == true {
|
||||
return session.ErrAlreadyStarted
|
||||
} else if err := api.Configure(); err != nil {
|
||||
if err := api.Configure(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue