unet-cli: fix defaults on create
authorFelix Fietkau <nbd@nbd.name>
Mon, 16 Dec 2024 11:33:19 +0000 (12:33 +0100)
committerFelix Fietkau <nbd@nbd.name>
Mon, 16 Dec 2024 11:33:19 +0000 (12:33 +0100)
Signed-off-by: Felix Fietkau <nbd@nbd.name>
scripts/unet-cli

index 8cb790e1d93fa7dbaf4e4ca45cb8c0511b1c69eb..9cbe64f14bdcf35e44e71a3ca344dedb825afe99 100755 (executable)
@@ -400,6 +400,9 @@ case 'import':
        break;
 case 'create':
 case 'set-config':
+       for (let key, val in defaults)
+               args[key] ??= `${val}`;
+
        set_fields(net_data.config, {
                port: "int",
                keepalive: "int",
@@ -407,9 +410,6 @@ case 'set-config':
        set_field("int", net_data.config, "peer-exchange-port", args.pex_port);
        set_field("array", net_data.config, "stun-servers", args.stun);
 
-       for (let key, val in defaults)
-               args[key] ??= `${val}`;
-
        let seed_arg;
 
        if ("seed" in args) {