config

package
v0.0.0-...-41d5bde Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthConfig

type AuthConfig struct {
	GithubClientId     string `env:"GITHUB_CLIENT_ID" required:"true"`
	GithubClientSecret string `env:"GITHUB_CLIENT_SECRET" required:"true"`
}

type ClientConfig

type ClientConfig struct {
	Ports     []PortMapping // The ports the client is tunneling
	ServerURL string        // The server URL to connect to when handling tunnels
	Token     string        // The auth token set VIA --login
}

ClientConfig will be set by the CLI app

func (*ClientConfig) NewWebSocketConfig

func (c *ClientConfig) NewWebSocketConfig() (*websocket.Config, error)

NewWebSocketConfig creates a websocket.Config for CLI usage

func (*ClientConfig) WebSocketURL

func (c *ClientConfig) WebSocketURL() string

WebSocketURL returns the WebSocket URL (ws:// or wss://) of the server for the client to connect to

type Config

type Config struct {
	Server   ServerConfig
	Database DatabaseConfig
}

func LoadConfig

func LoadConfig() (*Config, error)

type DatabaseConfig

type DatabaseConfig struct {
	Path string `env:"DB_PATH" required:"true"`
}

type PortMapping

type PortMapping struct {
	Port     int
	CustomId string
}

type ServerConfig

type ServerConfig struct {
	BaseURL string `env:"SERVER_URL" required:"true"`
	Port    string `env:"SERVER_PORT"`

	UseSubdomains bool `env:"USE_SUBDOMAINS" default:"false"`

	Auth AuthConfig

	Logger *slog.Logger
	// contains filtered or unexported fields
}

func (*ServerConfig) HTTPURL

func (c *ServerConfig) HTTPURL() string

HTTPURL returns the full HTTP URL of the server

func (*ServerConfig) SubdomainURL

func (c *ServerConfig) SubdomainURL(id string) string

SubdomainURL converts the server's base URL to a subdomainURL based on the id using the custom logic for local development and production

Jump to

Keyboard shortcuts

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