fix dev scripts.

This commit is contained in:
Miroslav Šedivý 2024-06-16 16:26:42 +02:00
parent f65f262d48
commit ae117ccdbb
5 changed files with 18 additions and 8 deletions

View File

@ -22,6 +22,10 @@ if [ -z $NEKO_NAT1TO1 ]; then
fi fi
done done
if [ -z $NEKO_NAT1TO1 ]; then
NEKO_NAT1TO1=$(hostname -I 2>/dev/null | awk '{print $1}')
fi
if [ -z $NEKO_NAT1TO1 ]; then if [ -z $NEKO_NAT1TO1 ]; then
NEKO_NAT1TO1=$(hostname -i 2>/dev/null) NEKO_NAT1TO1=$(hostname -i 2>/dev/null)
fi fi

View File

@ -3,8 +3,14 @@ package utils
import ( import (
"encoding/json" "encoding/json"
"reflect" "reflect"
"github.com/mitchellh/mapstructure"
) )
func Decode(input interface{}, output interface{}) error {
return mapstructure.Decode(input, output)
}
func Unmarshal(in any, raw []byte, callback func() error) error { func Unmarshal(in any, raw []byte, callback func() error) error {
if err := json.Unmarshal(raw, &in); err != nil { if err := json.Unmarshal(raw, &in); err != nil {
return err return err