config

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxWorkerNum           = 119   // Maximum of worker number
	MinWorkerNum           = 1     // Minimum of worker number
	MaxQueueSize           = 40960 // Maximum queue size.
	MinQueueSize           = 128   // Minimum Queue size.
	MaxRequestSize         = 5000  // Maximum of requset count.
	MinRequestSize         = 1     // Minimum of request size.
	LimitApnsTokenByteSize = 100   // Payload byte size.
)

Limit values

View Source
const (
	// Default array size of posted data. If not configures at file, this value is set.
	DefaultRequestQueueSize = 2000
	// Default port number of provider server
	DefaultPort = 8003
	// Default supervisor's queue size. If not configures at file, this value is set.
	DefaultQueueSize = 1000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Apns     SectionApns     `toml:"apns"`
	Provider SectionProvider `toml:"provider"`
	FCM      SectionFCM      `toml:"fcm"`
	FCMv1    SectionFCMv1    `toml:"fcm_v1"`
}

Config is the configure of an APNS provider server

func DefaultLoadConfig

func DefaultLoadConfig() (Config, error)

DefaultLoadConfig loads default /etc/gunfish.toml

func LoadConfig

func LoadConfig(fn string) (Config, error)

LoadConfig reads gunfish.toml and loads on ApnsConfig struct

type SectionApns

type SectionApns struct {
	Host                string
	CertFile            string `toml:"cert_file"`
	KeyFile             string `toml:"key_file"`
	Kid                 string `toml:"kid"`
	TeamID              string `toml:"team_id"`
	CertificateNotAfter time.Time
	Enabled             bool
}

SectionApns is the configure which is loaded from gunfish.toml

type SectionFCM

type SectionFCM struct {
	APIKey  string `toml:"api_key"`
	Enabled bool
}

SectionFCM is the configuration of fcm

type SectionFCMv1 added in v0.4.0

type SectionFCMv1 struct {
	GoogleApplicationCredentials string `toml:"google_application_credentials"`
	Enabled                      bool
	ProjectID                    string
	TokenSource                  oauth2.TokenSource
	Endpoint                     string
}

SectionFCMv1 is the configuration of fcm/v1

type SectionProvider

type SectionProvider struct {
	WorkerNum        int `toml:"worker_num"`
	QueueSize        int `toml:"queue_size"`
	RequestQueueSize int `toml:"max_request_size"`
	Port             int `toml:"port"`
	DebugPort        int
	MaxConnections   int    `toml:"max_connections"`
	ErrorHook        string `toml:"error_hook"`
}

SectionProvider is Gunfish provider configuration

Jump to

Keyboard shortcuts

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