config

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	HTTP: HTTPConfig{
		Listen: ":9091",
	},
	HarmonyDB: HarmonyDBConfig{
		URL: "postgres://yugabyte:yugabyte@127.0.0.1:5433/curio?search_path=curio",
	},
	Chain: ChainConfig{
		APIs: []string{
			"token:/ip4/127.0.0.1/tcp/1234/http",
		},
	},
	Auth: AuthConfig{
		Secret:  lo.RandomString(32, lo.LettersCharset),
		Expires: 24 * 30,
		Users: []UserConfig{
			{Username: "admin", Password: lo.RandomString(24, lo.LettersCharset), Description: "Administrator"},
		},
	},
	Features: FeaturesConfig{
		Metrics: MetricsConfig{
			Enabled:    true,
			Prometheus: "http://localhost:9090",
		},
	},
	Curio: CurioConfig{
		APIs: []string{
			"http://127.0.0.1:4701",
		},
	},
}

Functions

This section is empty.

Types

type AuthConfig

type AuthConfig struct {
	Secret  string       `toml:"secret" comment:"Secret key for JWT token, default to a random string, keep it confidential"`
	Expires int          `toml:"expires" comment:"Token expiration time in hours, default to 24 hours"`
	Users   []UserConfig `toml:"users" comment:"List of users allow to access the dashboard"`
}

type ChainConfig

type ChainConfig struct {
	APIs []string `toml:"apis" comment:"List of chain API to connect to"`
}

type Config

type Config struct {
	HTTP      HTTPConfig      `toml:"api" comment:"Http configuration"`
	HarmonyDB HarmonyDBConfig `toml:"harmonydb" comment:"HarmonyDB database configuration"`
	Chain     ChainConfig     `toml:"chain" comment:"Chain API configuration"`
	Curio     CurioConfig     `toml:"curio" comment:"Curio configuration"`
	Auth      AuthConfig      `toml:"auth" comment:"Authentication configuration"`
	Features  FeaturesConfig  `toml:"features" comment:"Features configuration"`
}

func NewFromFile

func NewFromFile(filePath string) (*Config, error)

type CurioConfig

type CurioConfig struct {
	APIs []string `toml:"apis" comment:"List of Curio API to connect to"`
}

type FeaturesConfig

type FeaturesConfig struct {
	Metrics MetricsConfig `toml:"metrics" comment:"Metrics configuration"`
}

type HTTPConfig

type HTTPConfig struct {
	Listen string `toml:"listen" comment:"Address to listen on for the API server"`
}

type HarmonyDBConfig

type HarmonyDBConfig struct {
	URL string `` /* 162-byte string literal not displayed */
}

type MetricsConfig

type MetricsConfig struct {
	Enabled    bool   `toml:"enabled" comment:"Enable metrics api for analytics, must provide the Prometheus URL for collecting Curio metrics."`
	Prometheus string `toml:"prometheus" comment:"URL to connect to the Prometheus server"`
}

type UserConfig

type UserConfig struct {
	Username    string `toml:"username" comment:"Username for the user"`
	Password    string `toml:"password" comment:"Password for the user, default to a random string"`
	Description string `toml:"description" comment:"Description for the user"`
}

Jump to

Keyboard shortcuts

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