Documentation ¶
Overview ¶
Package config reasd configurations from a YAML file and load them into a AppConfig type to save the configuration information for the application. Configuration for different environment can be saved in files with different suffix, for example [Dev], [Prod]
Index ¶
Constants ¶
const ( LOG_ENABLE_CALLER bool = true DB_CONFIG_CODE = "sql" DB_DRIVER_CODE string = "sqldb" DB_DRIVER_NAME string = "mysql" DB_NAME = "" DB_SOURCE_NAME string = "root:@tcp(localhost:4333)/service_config?charset=utf8" MESSAGING_SERVER_URL string = nats.DefaultURL SUBJECT_PAYMENT_CREATED string = "payment.paymentCreated" SUBJECT_PAYMENT_CANCELED string = "Payment.paymentCanceled" SUBJECT_MAKE_PAYMENT string = "payment.makePayment" )
use case code. Need to map to the use case code (UseCaseConfig) in the configuration yaml file. Client app use those to retrieve use case from the container
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppConfig ¶
type AppConfig struct { SQLConfig DataStoreConfig `yaml:"sqlConfig"` ZapConfig logConfig.Logging `yaml:"zapConfig"` LorusConfig logConfig.Logging `yaml:"logrusConfig"` LogConfig logConfig.Logging `yaml:"logConfig"` UseCaseConfig UseCaseConfig `yaml:"useCaseConfig"` }
AppConfig represents the application config
func BuildConfig ¶
BuildConfig build the AppConfig if the filaname is not empty, then it reads the file of the filename (in the same folder) and put it into the AppConfig
func BuildConfigWithoutFile ¶
BuildConfigWithoutFile create AppConfig with adhoc value
type DataConfig ¶
type DataConfig struct { Code string `yaml:"code"` DataStoreConfig DataStoreConfig `yaml:"dataStoreConfig"` }
// DataConfig represents data service
type DataStoreConfig ¶
type DataStoreConfig struct { Code string `yaml:"code"` // Only database has a driver name, for grpc it is "tcp" ( network) for server DriverName string `yaml:"driverName"` // For database, this is datasource name; for grpc, it is target url UrlAddress string `yaml:"urlAddress"` // Only some databases need this database name DbName string `yaml:"dbName"` }
DataConfig represents handlers for data store. It can be a database or a gRPC connection
type PaymentConfig ¶
type PaymentConfig struct { //Code string `yaml:"code"` PaymentDataConfig DataConfig `yaml:"userDataConfig"` }
RegistrationConfig represents registration use case
type UseCaseConfig ¶
type UseCaseConfig struct {
Payment PaymentConfig `yaml:"getPayment"`
}
UseCaseConfig represents different use cases