Handlers, DB, Cache
This commit is contained in:
@@ -2,13 +2,18 @@ package config
|
||||
|
||||
import (
|
||||
logging "payouts/internal/log/config"
|
||||
cache "payouts/internal/service/cache/config"
|
||||
database "payouts/internal/service/database/config"
|
||||
monitoring "payouts/internal/service/monitoring/config"
|
||||
yookassa "payouts/internal/service/yookassa/config"
|
||||
)
|
||||
|
||||
type App struct {
|
||||
Server Server
|
||||
Metrics monitoring.Metrics
|
||||
Database database.Database
|
||||
Cache cache.Cache
|
||||
Log logging.Log
|
||||
|
||||
YooKassa yookassa.YooKassa
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
@@ -17,6 +18,7 @@ import (
|
||||
const (
|
||||
ConfigPathArg = "config-path"
|
||||
ConfigPathDefault = "./payouts.properties"
|
||||
envConfigFile = "CONFIG_PATH"
|
||||
)
|
||||
|
||||
var Module = fx.Provide(NewAppConfig)
|
||||
@@ -36,7 +38,7 @@ func getConfigData(filePath string) (string, string, string) {
|
||||
func NewAppConfig() (*App, error) {
|
||||
mainConfig := &App{}
|
||||
|
||||
configPaths := []string{ConfigPathDefault}
|
||||
configPaths := []string{ConfigPathDefault, os.Getenv(envConfigFile)}
|
||||
|
||||
configPath := pflag.String(ConfigPathArg, "", "")
|
||||
pflag.Parse()
|
||||
|
||||
Reference in New Issue
Block a user