cmd

package
v0.0.0-...-84b55d0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BotCmd

type BotCmd struct {
	Reporter `group:"reporter" namespace:"reporter" env-namespace:"REPORTER"`
	Token    string `long:"token" env:"TOKEN" description:"Bot token" required:"true"`
	DB       string `long:"db" env:"DB" description:"Database filepath" required:"true" default:"bbolt.db"`
	CommonOpts
	Admins     []string       `short:"a" long:"admin" env:"ADMIN" env-delim:"," description:"Bot admin telegram usernames" required:"true"`
	Pattern    string         `long:"pattern" env:"PATTERN" description:"Bot server handler pattern" default:"/"`
	CertFile   flags.Filename `long:"cert" env:"CERT_FILE" description:"Bot server tls cert file"`
	KeyFile    flags.Filename `long:"key" env:"KEY_FILE" description:"Bot server tls key file"`
	WebhookURL string         `long:"webhook_url" env:"WEBHOOK_URL" description:"Bot server webhook url"`
	Address    string         `long:"address" env:"ADDRESS" description:"Bot server bind address" default:"0.0.0.0:443"`
	Hub        `group:"hub" namespace:"hub" env-namespace:"HUB"`
}

func (*BotCmd) Execute

func (cmd *BotCmd) Execute(_ []string) error

Execute gets statements list for specified merchant, entry point for "statements" command

type BuildInfo

type BuildInfo struct {
	Version string
	Commit  string
	Date    string
}

BuildInfo about the executable

type CommonOptionsCommander

type CommonOptionsCommander interface {
	SetCommon(commonOpts CommonOpts)
	Execute(args []string) error
}

CommonOptionsCommander extends flags.Commander with SetCommon All commands should implement this interfaces

type CommonOpts

type CommonOpts struct {
	Logger    *zap.Logger
	BuildInfo BuildInfo
	Debug     bool
}

CommonOpts sets externally from main, shared across all commands

func (*CommonOpts) SetCommon

func (opts *CommonOpts) SetCommon(commonOpts CommonOpts)

SetCommon satisfies CommonOptionsCommander interface and sets common option fields The method called by main for each command

type Hub

type Hub struct {
	AppHash     string         `long:"app_hash" env:"APP_HASH" description:"Telegram API app hash" required:"true"`
	PublicKey   flags.Filename `long:"pk" env:"PUBLIC_KEY" description:"Telegram API public key" required:"true"`
	DeviceModel string         `long:"device" env:"DEVICE" description:"Telegram API device model" default:"Dmitry Nev"`
	DCOption    struct {
		IPAddress string `long:"ip" env:"IP" description:"DC ip address" required:"true"`
		ID        int    `long:"id" env:"ID" description:"DC id" default:"2"`
		Port      int    `long:"port" env:"PORT" description:"DC port" default:"443"`
	} `group:"dc" namespace:"dc" env-namespace:"DC"`
	ClientTTL time.Duration `long:"client_ttl" env:"CLIENT_TTL" description:"A telegram API client TTL" default:"3m"`
	AppID     int           `long:"app_id" env:"APP_ID" description:"Telegram API app id" required:"true"`
}

type MergeCmd

type MergeCmd struct {
	Current flags.Filename `long:"current" env:"CURRENT" description:"Current database filepath" required:"true" default:"current.db"`
	Target  flags.Filename `long:"target" env:"TARGET" description:"Target database filepath" required:"true" default:"target.db"`
	CommonOpts
}

func (*MergeCmd) Execute

func (cmd *MergeCmd) Execute(args []string) error

type Merger

type Merger interface {
	MergeUser(user store.User) error
}

type Reporter

type Reporter struct {
	Message string `` // nolint
	/* 262-byte string literal not displayed */
	Interval           time.Duration `long:"interval" env:"INTERVAL" description:"Interval between sending reports" default:"40m"`
	IntervalMaxReports int           `long:"max_reps" env:"INTERVAL_MAX_REPORTS" default:"25" description:"Max number of sent reports from a telegram client"` // nolint
}

Jump to

Keyboard shortcuts

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