new: exporting module parameters current value in api.rest

This commit is contained in:
evilsocket 2019-03-14 21:05:33 +01:00
commit 0f427911be
No known key found for this signature in database
GPG key ID: 1564D7F30393A456
2 changed files with 21 additions and 7 deletions

View file

@ -99,17 +99,19 @@ func (env *Environment) Set(name, value string) string {
return old
}
func (env *Environment) Get(name string) (bool, string) {
env.Lock()
defer env.Unlock()
func (env *Environment) GetUnlocked(name string) (bool, string) {
if value, found := env.Data[name]; found {
return true, value
}
return false, ""
}
func (env *Environment) Get(name string) (bool, string) {
env.Lock()
defer env.Unlock()
return env.GetUnlocked(name)
}
func (env *Environment) GetInt(name string) (error, int) {
if found, value := env.Get(name); found {
if i, err := strconv.Atoi(value); err == nil {