config

package
v0.0.0-...-0871eb3 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cipher

func Cipher()

Cipher is to decrypt crypted string on config

func ResetConf

func ResetConf()

ResetConf is to clear config instance

func SetTOMLPath

func SetTOMLPath(path string)

SetTOMLPath is to set TOML file path

Types

type AwsConfig

type AwsConfig struct {
	Encrypted bool       `toml:"encrypted"`
	AccessKey string     `toml:"access_key"`
	SecretKey string     `toml:"secret_key"`
	Region    string     `toml:"region"`
	Sqs       *SqsConfig `toml:"sqs"`
}

AwsConfig is for Aamazon Web Service

type CassaConfig

type CassaConfig struct {
	Encrypted bool   `toml:"encrypted"`
	Host      string `toml:"host"`
	Port      uint16 `toml:"port"`
	KeySpace  string `toml:"keyspace"`
}

CassaConfig is for Cassandra server

type Config

type Config struct {
	Environment int
	MySQL       *MySQLConfig
	Redis       *RedisConfig
	Mongo       *MongoConfig `toml:"mongodb"`
	Cassa       *CassaConfig `toml:"cassandra"`
	Mail        *MailConfig
	Aws         *AwsConfig
}

Config is of root

func GetConf

func GetConf() *Config

GetConf is to get config instance. singleton architecture

func New

func New(file string, cipherFlg bool) (*Config, error)

New is to create config instance

func NewInstance

func NewInstance(file string, cipherFlg bool) (*Config, error)

NewInstance is to return new config instance

type MailConfig

type MailConfig struct {
	Encrypted bool                `toml:"encrypted"`
	Address   string              `toml:"address"`
	Password  string              `toml:"password"`
	Timeout   string              `toml:"timeout"`
	SMTP      *SMTPConfig         `toml:"smtp"`
	Content   []MailContentConfig `toml:"content"`
}

MailConfig is for mail

type MailContentConfig

type MailContentConfig struct {
	Subject string `toml:"subject"`
	Tplfile string `toml:"tplfile"`
}

MailContentConfig is for mail contents

type MongoConfig

type MongoConfig struct {
	Encrypted bool   `toml:"encrypted"`
	Host      string `toml:"host"`
	Port      uint16 `toml:"port"`
	DbName    string `toml:"dbname"`
	User      string `toml:"user"`
	Pass      string `toml:"pass"`
}

MongoConfig is for MongoDB server

type MsgAttrConfig

type MsgAttrConfig struct {
	OpType      string `toml:"operation_type"`
	ContentType string `toml:"content_type"`
}

MsgAttrConfig is for part of SQS

type MySQLConfig

type MySQLConfig struct {
	Encrypted bool   `toml:"encrypted"`
	Host      string `toml:"host"`
	Port      uint16 `toml:"port"`
	DbName    string `toml:"dbname"`
	User      string `toml:"user"`
	Pass      string `toml:"pass"`
}

MySQLConfig is for MySQL server

type RedisConfig

type RedisConfig struct {
	Encrypted bool   `toml:"encrypted"`
	Host      string `toml:"host"`
	Port      uint16 `toml:"port"`
	Pass      string `toml:"pass"`
}

RedisConfig is for Redis server

type SMTPConfig

type SMTPConfig struct {
	Server string `toml:"server"`
	Port   int    `toml:"port"`
}

SMTPConfig is for SMTP server of mail

type SqsConfig

type SqsConfig struct {
	Endpoint      string        `toml:"endpoint"`
	QueueName     string        `toml:"queue_name"`
	DeadQueueName string        `toml:"deadque_name"`
	MsgAttr       MsgAttrConfig `toml:"msgattr"`
}

SqsConfig is for SQS of AWS

Jump to

Keyboard shortcuts

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