config

package
v0.0.0-...-9835270 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2021 License: AGPL-3.0, Apache-2.0, MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(configPath string) error

Types

type ConnectorConf

type ConnectorConf struct {
	Host string `yaml:"host"`
	Port string `yaml:"port"`
}

type ConsumerConf

type ConsumerConf struct {
	Topic      string `yaml:"topic"`
	Group      string `yaml:"group"`
	Underlying string `yaml:"underlying"`
	Name       string `yaml:"name"`

	AutoCommit       *bool   `yaml:"enable_auto_commit,omitempty"`
	CommitIntervalMS *int    `yaml:"auto_commit_interval_ms,omitempty"`
	AutoOffsetReset  *string `yaml:"topic_auto_offset_reset,omitempty"`
	EnableGoChannel  *bool   `yaml:"go_channel_enable,omitempty"`
}

func (*ConsumerConf) AutoCommitIntervalMS

func (c *ConsumerConf) AutoCommitIntervalMS() *int

func (*ConsumerConf) EnableAutoCommit

func (c *ConsumerConf) EnableAutoCommit() *bool

func (*ConsumerConf) GoChannelEnable

func (c *ConsumerConf) GoChannelEnable() *bool

func (*ConsumerConf) TopicAutoOffsetReset

func (c *ConsumerConf) TopicAutoOffsetReset() *string

type DataBaseConf

type DataBaseConf struct {
	Driver    string `yaml:"driver"`
	Addresses string `yaml:"addresses"`
}

type Fed

type Fed struct {
	Version    int `yaml:"version"`
	Homeserver struct {
		ServerName   []string `yaml:"server_name"`
		ServerFromDB bool     `yaml:"server_from_db"`
	} `yaml:"homeserver"`

	TransportConfs []TransportConf `yaml:"transport_configs"`
	// The configuration for talking to kafka.
	Kafka struct {
		CommonCfg struct {
			EnableIdempotence bool `yaml:"enable_idempotence"`
			ForceAsyncSend    bool `yaml:"force_async_send"`
			ReplicaFactor     int  `yaml:"replica_factor"`
			NumPartitions     int  `yaml:"num_partitions"`
			NumProducers      int  `yaml:"num_producers"`
		} `yaml:"common_cfg"`
		Producer struct {
			DBUpdates       ProducerConf `yaml:"db_updates"`
			DispatchOutput  ProducerConf `yaml:"dispatch_output"`
			FedAPIOutput    ProducerConf `yaml:"fedapi_output"`
			GetMissingEvent ProducerConf `yaml:"get_missing_event"`
			DownloadMedia   ProducerConf `yaml:"download_media"`
			InputRoomEvent  ProducerConf `yaml:"input_room_event"`
		} `yaml:"producers"`
		Consumer struct {
			DispatchInput   ConsumerConf `yaml:"dispatch_input"`
			SenderInput     ConsumerConf `yaml:"fedsenser_input"`
			FedAPIInput     ConsumerConf `yaml:"fedapi_input"`
			FedBackFill     ConsumerConf `yaml:"fed_backfill"`
			EduSenderInput  ConsumerConf `yaml:"edusender_input"`
			SettingUpdate   ConsumerConf `yaml:"setting_update"`
			GetMissingEvent ConsumerConf `yaml:"get_missing_event"`
		} `yaml:"consumers"`
	} `yaml:"kafka"`
	Nats struct {
		Uri string `yaml:"uri"`
	} `yaml:"nats"`
	Rpc struct {
		RsQryTopic          string `yaml:"rs_qry_topic"`
		PrQryTopic          string `yaml:"pr_qry_topic"`
		AliasTopic          string `yaml:"alias_topic"`
		RoomInputTopic      string `yaml:"room_input_topic"`
		FedTopic            string `yaml:"fed_topic"`
		FedAliasTopic       string `yaml:"fed_alias_topic"`
		FedProfileTopic     string `yaml:"fed_profile_topic"`
		FedAvatarTopic      string `yaml:"fed_avatar_topic"`
		FedDisplayNameTopic string `yaml:"fed_displayname_topic"`
		FedRsQryTopic       string `yaml:"fed_rs_qry_topic"`
		FedRsDownloadTopic  string `yaml:"fed_download_topic"`
		FedRsInviteTopic    string `yaml:"fed_invite_topic"`
		FedUserInfoTopic    string `yaml:"fed_user_info_topic"`
		FedRsMakeJoinTopic  string `yaml:"fed_makejoin_topic"`
		FedRsSendJoinTopic  string `yaml:"fed_sendjoin_topic"`
		FedRsMakeLeaveTopic string `yaml:"fed_makeleave_topic"`
		FedRsSendLeaveTopic string `yaml:"fed_sendleave_topic"`
	} `yaml:"rpc"`
	Media struct {
		UploadUrl string `yaml:"upload_url"`
	} `yaml:"media"`
	Database struct {
		CreateDB   DataBaseConf `yaml:"create_db"`
		RoomServer DataBaseConf `yaml:"room_server"`
		Federation DataBaseConf `yaml:"federation"`
		ServerConf DataBaseConf `yaml:"server_conf"`
		ServerKey  DataBaseConf `yaml:"server_key"`
		Encryption DataBaseConf `yaml:"encryption"`
		Account    DataBaseConf `yaml:"account"`
		UseSync    bool         `yaml:"use_sync"`
	} `yaml:"database"`
	Redis struct {
		Uris []string `yaml:"uris"`
	} `yaml:"redis"`
	Log struct {
		Debug          bool     `yaml:"debug"`
		Level          string   `yaml:"level"`
		Files          []string `yaml:"files"`
		Underlying     string   `yaml:"underlying"`
		WriteToStdout  bool     `yaml:"write_to_stdout"`
		RedirectStderr bool     `yaml:"redirect_stderr"`
		ZapConfig      struct {
			MaxSize    int    `yaml:"max_size"`
			MaxBackups int    `yaml:"max_backups"`
			MaxAge     int    `yaml:"max_age"`
			LocalTime  bool   `yaml:"localtime"`
			Compress   bool   `yaml:"compress"`
			JsonFormat bool   `yaml:"json_format"`
			BtEnabled  bool   `yaml:"bt_enabled"`
			BtLevel    string `yaml:"bt_level"`
		} `yaml:"zap_config"`
	} `yaml:"log"`

	Cache struct {
		DurationDefault int `yaml:"durationDefault"`
		DurationRefresh int `yaml:"durationRefresh"`
	} `yaml:"cache"`

	NotaryService struct {
		CliHttpsEnable bool   `yaml:"cli_https_enable"`
		RootCAUrl      string `yaml:"root_ca_url"`
		CRLUrl         string `yaml:"crl_url"`
		CertUrl        string `yaml:"cert_url"`
	} `yaml:"notary_service"`
}

func GetFedConfig

func GetFedConfig() Fed

func (Fed) GetDBConfig

func (f Fed) GetDBConfig(name string) (driver string, createAddr string, addr string, persistUnderlying string, persistName string, async bool)

func (Fed) GetMsgBusAddress

func (f Fed) GetMsgBusAddress() string

func (Fed) GetMsgBusReqTopic

func (f Fed) GetMsgBusReqTopic() string

func (Fed) GetMsgBusResTopic

func (f Fed) GetMsgBusResTopic() string

func (Fed) GetServerFromDB

func (f Fed) GetServerFromDB() bool

func (Fed) GetServerName

func (f Fed) GetServerName() []string

type ProducerConf

type ProducerConf struct {
	Topic      string `yaml:"topic"`
	Underlying string `yaml:"underlying"`
	Name       string `yaml:"name"`
	Inst       int    `yaml:"inst"`

	LingerMs *string `yaml:"linger_ms,omitempty"`
}

func (*ProducerConf) LingerMsConf

func (p *ProducerConf) LingerMsConf() *string

type TransportConf

type TransportConf struct {
	Addresses  string `yaml:"addresses"`
	Underlying string `yaml:"underlying"`
	Name       string `yaml:"name"`
}

Jump to

Keyboard shortcuts

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