tunnel

package
v2.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cli.Command{
	Name:  "tunnel",
	Usage: "Manage Cloudflare tunnels",
	Flags: []cli.Flag{
		&cli.BoolFlag{
			Name:  dryRunFlag,
			Value: false,
			Usage: "Simulate actions without making any changes",
		},
		&cli.StringFlag{
			Name:  configPathFlag,
			Value: "moley.yml",
			Usage: "Path to the tunnel configuration file",
		},
	},
	Commands: []*cli.Command{
		runCmd,
		stopCmd,
		{
			Name:  "init",
			Usage: "Initialize a new tunnel configuration file",
			Action: func(ctx context.Context, cmd *cli.Command) error {

				logger.Info("Initializing new tunnel configuration")

				configPath := cmd.String(configPathFlag)

				mgr, err := config.NewTunnelManager(configPath)
				if err != nil {
					return shared.WrapError(err, "initialize tunnel config failed")
				}

				example, err := config.ExampleTunnelConfig()
				if err != nil {
					return shared.WrapError(err, "create example tunnel config failed")
				}

				if err := mgr.Override(example); err != nil {
					return shared.WrapError(err, "override tunnel config failed")
				}

				logger.Infof("Tunnel configuration initialized", map[string]any{
					"config": configPath,
				})
				return nil
			},
		},
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL