github.com/mysteriumnetwork/node@v0.0.0-20240516044423-365054f76801/config/flags_ui.go (about) 1 /* 2 * Copyright (C) 2022 The "MysteriumNetwork/node" Authors. 3 * 4 * This program is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation, either version 3 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 18 package config 19 20 import "github.com/urfave/cli/v2" 21 22 var ( 23 // FlagUIFeatures toggle NodeUI features 24 FlagUIFeatures = cli.StringFlag{ 25 Name: "ui.features", 26 Usage: "Enable NodeUI features. Multiple features are joined by comma (e.g feature1,feature2,...)", 27 Value: "", 28 } 29 // FlagUIEnable enables built-in web UI for node. 30 FlagUIEnable = cli.BoolFlag{ 31 Name: "ui.enable", 32 Usage: "Enables the Web UI", 33 Value: true, 34 } 35 // FlagUIAddress IP address of interface to listen for incoming connections. 36 FlagUIAddress = cli.StringFlag{ 37 Name: "ui.address", 38 Usage: "IP address to bind Web UI to. Address can be comma delimited: '192.168.1.10,192.168.1.20'. (default - 127.0.0.1 and local LAN IP)", 39 Value: "", 40 } 41 // FlagUIPort runs web UI on the specified port. 42 FlagUIPort = cli.IntFlag{ 43 Name: "ui.port", 44 Usage: "The port to run Web UI on", 45 Value: 4449, 46 } 47 ) 48 49 // RegisterFlagsUI register Node UI flags to the list 50 func RegisterFlagsUI(flags *[]cli.Flag) { 51 *flags = append( 52 *flags, 53 &FlagUIFeatures, 54 &FlagUIEnable, 55 &FlagUIAddress, 56 &FlagUIPort, 57 ) 58 } 59 60 // ParseFlagsUI parse Node UI flags 61 func ParseFlagsUI(ctx *cli.Context) { 62 Current.ParseStringFlag(ctx, FlagUIFeatures) 63 Current.ParseBoolFlag(ctx, FlagUIEnable) 64 Current.ParseStringFlag(ctx, FlagUIAddress) 65 Current.ParseIntFlag(ctx, FlagUIPort) 66 }