secrets

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RedisModeSingle      = "single"
	RedisModeReplication = "replication"
	RedisModeCluster     = "cluster"
)

Variables

View Source
var PATH = ""

Functions

func Load

func Load(typ string, name string, secret Secret) error

func LoadWithFS

func LoadWithFS(typ string, name string, secret Secret, fs FileSystem) error

func Path

func Path() string

func SetFileSystem

func SetFileSystem(fs FileSystem)

Types

type Cassandra

type Cassandra struct {
	DefaultSecret
	Writer CassandraMeta `json:"writer"`
	Reader CassandraMeta `json:"reader"`
}

type CassandraMeta

type CassandraMeta struct {
	Hosts     []string `json:"hosts"`
	Endpoints []string `json:"endpoints"`
	Keyspace  string   `json:"keyspace"`
	Username  string   `json:"username"`
	Password  string   `json:"password"`
	CaPath    string   `json:"ca_path"`
}

type Database

type Database struct {
	DefaultSecret
	Writer DatabaseMeta `json:"writer"`
	Reader DatabaseMeta `json:"reader"`
}

func DatabaseProfile

func DatabaseProfile(name string) *Database

func DatabaseProfileWithFS

func DatabaseProfileWithFS(name string, fs FileSystem) *Database

type DatabaseMeta

type DatabaseMeta struct {
	Adapter string `json:"adapter"`
	Params  struct {
		Charset  string `json:"charset"`
		Host     string `json:"host"`
		Port     uint   `json:"port"`
		DBName   string `json:"dbname"`
		Username string `json:"username"`
		Password string `json:"password"`
	} `json:"params"`
}

type DefaultFileSystem

type DefaultFileSystem struct{}

func NewDefaultFileSystem

func NewDefaultFileSystem() *DefaultFileSystem

func (*DefaultFileSystem) ReadFile

func (fs *DefaultFileSystem) ReadFile(filename string) ([]byte, error)

func (*DefaultFileSystem) Stat

func (fs *DefaultFileSystem) Stat(name string) (os.FileInfo, error)

type DefaultSecret

type DefaultSecret struct {
	// contains filtered or unexported fields
}

func (*DefaultSecret) Name

func (d *DefaultSecret) Name() string

func (*DefaultSecret) Path

func (d *DefaultSecret) Path() string

type FileSystem

type FileSystem interface {
	Stat(name string) (os.FileInfo, error)
	ReadFile(filename string) ([]byte, error)
}

type Redis

type Redis struct {
	DefaultSecret
	Mode     string             `json:"mode"`
	Username string             `json:"username"`
	Password string             `json:"password"`
	DB       int                `json:"db"`
	Master   RedisMeta          `json:"master"`
	Slave    RedisMeta          `json:"slave"`
	Cluster  RedisClusterSecret `json:"cluster"`
}

func LoadRedisProfile

func LoadRedisProfile(name string) (*Redis, error)

func LoadRedisProfileWithFS

func LoadRedisProfileWithFS(name string, fs FileSystem) (*Redis, error)

func (*Redis) MasterAddrs

func (p *Redis) MasterAddrs() []string

func (*Redis) Normalize

func (p *Redis) Normalize()

func (*Redis) SlaveAddrs

func (p *Redis) SlaveAddrs() []string

type RedisClusterSecret

type RedisClusterSecret struct {
	Addrs          []string `json:"addrs"`
	ReadOnly       bool     `json:"read_only"`
	RouteByLatency bool     `json:"route_by_latency"`
	RouteRandomly  bool     `json:"route_randomly"`
}

type RedisMeta

type RedisMeta struct {
	Host string `json:"host"`
	Port uint   `json:"port"`
}

type RedisProfile

type RedisProfile = Redis

type Secret

type Secret interface {
	Name() string
	Path() string
}

Jump to

Keyboard shortcuts

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