Handlers, DB, Cache

This commit is contained in:
2026-03-10 19:17:43 +03:00
parent e56b1f1305
commit 968c030939
23 changed files with 566 additions and 34 deletions

View File

@@ -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
}

View File

@@ -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()