apiserver

package
v0.1.32 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: MIT Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package apiserver provides the command for the apiserver.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCommand

func NewCommand(opt CommandOption) *cobra.Command

NewCommand creates a new apiserver command.

Types

type CommandOption

type CommandOption struct {

	// flags
	Address  string `mapstructure:"address"`
	ServerID string `mapstructure:"serverId"`
	Database struct {
		Type           string        `mapstructure:"type"`
		Endpoints      []string      `mapstructure:"endpoints"`
		ConnectTimeout time.Duration `mapstructure:"connectTimeout"`
		DatabaseName   string        `mapstructure:"databaseName"`
		DDLAuto        bool          `mapstructure:"ddlAuto"`
	} `mapstructure:"database"`
	ServiceName string `mapstructure:"serviceName"`
	Event       struct {
		Type  string `mapstructure:"type"`
		Kafka struct {
			Brokers []string `mapstructure:"brokers"`
			Topic   string   `mapstructure:"topic"`
		}
	} `mapstructure:"event"`
	Management struct {
		Address string `mapstructure:"address"`
		Metric  struct {
			Enabled    bool   `mapstructure:"enabled"`
			Type       string `mapstructure:"type"`
			Prometheus struct {
				Path string `mapstructure:"path"`
			} `mapstructure:"prometheus"`
			OpenTelemetry struct {
				Endpoint string `mapstructure:"endpoint"`
			} `mapstructure:"openTelemetry"`
		}
		Log struct {
			Enabled bool   `mapstructure:"enabled"`
			Level   string `mapstructure:"level"`
			Format  string `mapstructure:"format"`
		} `mapstructure:"log"`
		Trace struct {
			Enabled              bool              `mapstructure:"enabled"`
			Protocol             string            `mapstructure:"protocol"`
			Compression          bool              `mapstructure:"compression"`
			CompressionAlgorithm string            `mapstructure:"compressionAlgorithm"`
			Insecure             bool              `mapstructure:"insecure"`
			Headers              map[string]string `mapstructure:"headers"`
			Endpoint             string            `mapstructure:"endpoint"`
			Sampler              string            `mapstructure:"sampler"`
			SamplerRatio         float64           `mapstructure:"samplerRatio"`
		} `mapstructure:"trace"`
	} `mapstructure:"management"`
	Auth struct {
		Enabled bool `mapstructure:"enabled"`
		Admin   struct {
			Username string `mapstructure:"username"`
			Password string `mapstructure:"password"`
			Email    string `mapstructure:"email"`
		} `mapstructure:"admin"`
		JWT struct {
			Issuer   string        `mapstructure:"issuer"`
			Expire   time.Duration `mapstructure:"expire"`
			Secret   string        `mapstructure:"secret"`
			Audience []string      `mapstructure:"audience"`
		}
		Type   string `mapstructure:"type"`
		OAuth2 struct {
			Provider     string `mapstructure:"provider"`
			ClientID     string `mapstructure:"clientId"`
			ClientSecret string `mapstructure:"clientSecret"`
			RedirectURI  string `mapstructure:"redirectUri"`
			State        struct {
				Mode string `mapstructure:"mode"`
				JWT  struct {
					Issuer   string        `mapstructure:"issuer"`
					Expire   time.Duration `mapstructure:"expire"`
					Secret   string        `mapstructure:"secret"`
					Audience []string      `mapstructure:"audience"`
				} `mapstructure:"jwt"`
			} `mapstructure:"state"`
		} `mapstructure:"oauth2"`
	} `mapstructure:"auth"`
	// contains filtered or unexported fields
}

CommandOption contains the options for the apiserver command.

func (*CommandOption) Init added in v0.1.0

func (opt *CommandOption) Init(cmd *cobra.Command, _ []string) error

Init initializes the command options.

func (*CommandOption) Prepare

func (opt *CommandOption) Prepare(_ *cobra.Command, _ []string) error

Prepare prepares the command.

func (*CommandOption) Run

func (opt *CommandOption) Run(cmd *cobra.Command, _ []string) error

Run runs the command.

Jump to

Keyboard shortcuts

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