Documentation
¶
Index ¶
- func GenerateKeyToFile(fname string) error
- func GetDidResolver(cctx *cli.Context) did.Resolver
- func GetPLCClient(cctx *cli.Context) *api.PLCServer
- func GetXrpcClient(cctx *cli.Context, authreq bool) (*xrpc.Client, error)
- func LoadKeyFromFile(kfile string) (*did.PrivKey, error)
- func NewHttpClient() *http.Client
- func ReadAuth(fname string) (*xrpc.AuthInfo, error)
- func SetIpfsWriter(out io.Writer, format string, level string)
- func SetupDatabase(dburl string, maxConnections int) (*gorm.DB, error)
- func SetupSlog(options LogOptions) (*slog.Logger, error)
- func TryReadConfig()
- func WriteConfig(cfg *CliConfig) error
- type CliConfig
- type LogOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateKeyToFile ¶
GenerateKeyToFile makes the private key and store it into the file
func GetDidResolver ¶
func GetPLCClient ¶
func LoadKeyFromFile ¶
LoadKeyFromFile reads the private key from file
func NewHttpClient ¶
func SetupDatabase ¶
Supports both previous "dbtype=" prefixed DSNs, and URI-style database config strings, for both sqlite and postgresql.
Examples: - "sqlite=dir/file.sqlite" - "sqlite://file.sqlite" - "postgres=host=localhost user=postgres password=password dbname=pdsdb port=5432 sslmode=disable" - "postgresql://postgres:password@localhost:5432/pdsdb?sslmode=disable"
func SetupSlog ¶
func SetupSlog(options LogOptions) (*slog.Logger, error)
SetupSlog integrates passed in options and env vars.
passing default cliutil.LogOptions{} is ok.
BSKYLOG_LOG_LEVEL=info|debug|warn|error
BSKYLOG_LOG_FMT=text|json
BSKYLOG_FILE=path (or "-" or "" for stdout), %T gets UnixMilli; if a path with '/', {prefix}/current becomes a link to active log file
BSKYLOG_ROTATE_BYTES=int maximum size of log chunk before rotating
BSKYLOG_ROTATE_KEEP=int keep N olg logs (not including current)
The env vars were derived from ipfs logging library, and also respond to some GOLOG_ vars from that library, but BSKYLOG_ variables are preferred because imported code still using the ipfs log library may misbehave if some GOLOG values are set, especially GOLOG_FILE.
func TryReadConfig ¶
func TryReadConfig()
func WriteConfig ¶
Types ¶
type CliConfig ¶
type CliConfig struct { PDS string // contains filtered or unexported fields }
var Config *CliConfig
type LogOptions ¶
type LogOptions struct { // e.g. 1_000_000_000 LogRotateBytes int64 // path to write to, if rotating, %T gets UnixMilli at file open time // NOTE: substitution is simple replace("%T", "") LogPath string // text|json LogFormat string // info|debug|warn|error LogLevel string // Keep N old logs (not including current); <0 disables removal, 0==remove all old log files immediately KeepOld int }