cmd

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ClientCmd = &cli.Command{
	Name:        "client",
	Description: "run client",
	Action:      runClient,
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:        "port",
			Value:       defaultServerPort,
			Usage:       "port to reach the API server running locally",
			Destination: &serverPort,
			Sources:     cli.ValueSourceChain{Chain: []cli.ValueSource{portEnvVar}},
		},
	},
}
View Source
var ExampleCmd = &cli.Command{
	Name:        "example",
	Description: "run example",
	Action:      runExample,
}
View Source
var (
	RunCmd = &cli.Command{
		Name:        "run",
		Description: "build and run a plugin",
		Action:      runPluginCmd,
		Flags: []cli.Flag{
			&cli.StringFlag{
				Name:        "plugin",
				Aliases:     []string{"p"},
				Required:    true,
				TakesFile:   true,
				Usage:       "filename for *.so plugin or directory for building it",
				Destination: &pluginFilename,
				Validator: func(v string) error {
					if filepath.Ext(v) == ".so" {
						return nil
					}

					stat, err := os.Stat(v)
					if err != nil {
						return err
					}

					if !stat.IsDir() {
						return errors.New("plugin must be .so file or directory to build from")
					}
					isDir = true

					return nil
				},
			},
			&cli.StringFlag{
				Name:        "subdomain",
				Aliases:     []string{"d"},
				Usage:       "subdomain name",
				DefaultText: "plugin filename (without .so)",
				Destination: &subdomain,
			},
			&cli.StringFlag{
				Name:    "env",
				Aliases: []string{"e"},
				Usage: "environment variable to communicate IP. Goblin will set this env var" +
					" with the allocated IP and run your application's main() function",
				Destination: &ipEnvVar,
			},
			&cli.StringFlag{
				Name:        "port",
				Value:       defaultServerPort,
				Usage:       "port to reach the API server running locally",
				Destination: &serverPort,
				Sources:     cli.ValueSourceChain{Chain: []cli.ValueSource{portEnvVar}},
			},
		},
	}
)
View Source
var (
	ServerCmd = &cli.Command{
		Name:        "server",
		Description: "run server",
		Action:      runServer,
		Flags: []cli.Flag{
			&cli.StringFlag{
				Name:        "domain",
				Aliases:     []string{"d"},
				Value:       "goblin",
				Usage:       "top-level domain name to use",
				Destination: &topLevelDomain,
			},
			&cli.StringFlag{
				Name:        "port",
				Aliases:     []string{"p"},
				Value:       defaultServerPort,
				Usage:       "port to run the API server on",
				Destination: &serverPort,
				Sources:     cli.ValueSourceChain{Chain: []cli.ValueSource{portEnvVar}},
			},
			&cli.StringFlag{
				Name:        "dns-port",
				Aliases:     []string{"s"},
				Value:       defaultDNSPort,
				Usage:       "port to run the DNS server on",
				Destination: &dnsPort,
			},
			&cli.StringFlag{
				Name:      "fallback-routes",
				Aliases:   []string{"r"},
				TakesFile: true,
				Validator: func(v string) error {
					if filepath.Ext(v) != ".json" {
						return errors.New("fallback-routes must be JSON file")
					}
					return nil
				},
				Usage: `path to a JSON file holding fallback route config in this format:
{
  "subdomain": {
    "Hostname": "remote-server.mydomain",
    "Ports": [8080]
  }
}`,
				Destination: &fallbackConfig,
			},
		},
	}
)

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
JackTT - Gopher 🇻🇳