diff --git a/dev/fmt b/dev/fmt index 977f8802..69c24eef 100755 --- a/dev/fmt +++ b/dev/fmt @@ -2,8 +2,8 @@ cd "$(dirname "$0")" if [ "$(docker images -q neko_server_build 2> /dev/null)" == "" ]; then - echo "Image 'neko_server_build' not found. Run ./build first." - exit 1 + echo "Image 'neko_server_build' not found. Run ./build first." + exit 1 fi docker run -it --rm \ diff --git a/dev/go b/dev/go index 731d1d14..ae0acf12 100755 --- a/dev/go +++ b/dev/go @@ -2,8 +2,8 @@ cd "$(dirname "$0")" if [ "$(docker images -q neko_server_build 2> /dev/null)" == "" ]; then - echo "Image 'neko_server_build' not found. Run ./build first." - exit 1 + echo "Image 'neko_server_build' not found. Run ./build first." + exit 1 fi docker run -it \ diff --git a/dev/lint b/dev/lint index a7aa6203..4124fda4 100755 --- a/dev/lint +++ b/dev/lint @@ -2,8 +2,8 @@ cd "$(dirname "$0")" if [ "$(docker images -q neko_server_build 2> /dev/null)" == "" ]; then - echo "Image 'neko_server_build' not found. Run ./build first." - exit 1 + echo "Image 'neko_server_build' not found. Run ./build first." + exit 1 fi # diff --git a/dev/start b/dev/start index 514bd2f2..210e61c0 100755 --- a/dev/start +++ b/dev/start @@ -2,8 +2,8 @@ cd "$(dirname "$0")" if [ -z "$(docker images -q neko_server_app 2> /dev/null)" ]; then - echo "Image 'neko_server_app' not found. Running ./build first." - ./build + echo "Image 'neko_server_app' not found. Running ./build first." + ./build fi if [ -z $NEKO_PORT ]; then @@ -22,6 +22,10 @@ if [ -z $NEKO_NAT1TO1 ]; then fi done + if [ -z $NEKO_NAT1TO1 ]; then + NEKO_NAT1TO1=$(hostname -I 2>/dev/null | awk '{print $1}') + fi + if [ -z $NEKO_NAT1TO1 ]; then NEKO_NAT1TO1=$(hostname -i 2>/dev/null) fi diff --git a/pkg/utils/json.go b/pkg/utils/deocde.go similarity index 81% rename from pkg/utils/json.go rename to pkg/utils/deocde.go index ff4883b0..12aeaec7 100644 --- a/pkg/utils/json.go +++ b/pkg/utils/deocde.go @@ -3,8 +3,14 @@ package utils import ( "encoding/json" "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 { if err := json.Unmarshal(raw, &in); err != nil { return err