From 215737d6c5b2f6a99d99e16a38e4c08ee73ff35c Mon Sep 17 00:00:00 2001 From: bnkai <48220860+bnkai@users.noreply.github.com> Date: Thu, 18 Mar 2021 02:07:56 +0200 Subject: [PATCH] Add configFilePath and scrapersPath to configuration query (#1205) --- graphql/schema/types/config.graphql | 4 ++++ pkg/api/resolver_query_configuration.go | 2 ++ pkg/manager/config/config.go | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/graphql/schema/types/config.graphql b/graphql/schema/types/config.graphql index f3f7c8142..24b243138 100644 --- a/graphql/schema/types/config.graphql +++ b/graphql/schema/types/config.graphql @@ -94,6 +94,10 @@ type ConfigGeneralResult { databasePath: String! """Path to generated files""" generatedPath: String! + """Path to the config file used""" + configFilePath: String! + """Path to scrapers""" + scrapersPath: String! """Path to cache""" cachePath: String! """Whether to calculate MD5 checksums for scene video files""" diff --git a/pkg/api/resolver_query_configuration.go b/pkg/api/resolver_query_configuration.go index c1d45ba8b..cd4bbaff4 100644 --- a/pkg/api/resolver_query_configuration.go +++ b/pkg/api/resolver_query_configuration.go @@ -46,6 +46,8 @@ func makeConfigGeneralResult() *models.ConfigGeneralResult { Stashes: config.GetStashPaths(), DatabasePath: config.GetDatabasePath(), GeneratedPath: config.GetGeneratedPath(), + ConfigFilePath: config.GetConfigFilePath(), + ScrapersPath: config.GetScrapersPath(), CachePath: config.GetCachePath(), CalculateMd5: config.IsCalculateMD5(), VideoFileNamingAlgorithm: config.GetVideoFileNamingAlgorithm(), diff --git a/pkg/manager/config/config.go b/pkg/manager/config/config.go index cdb136627..a858d6722 100644 --- a/pkg/manager/config/config.go +++ b/pkg/manager/config/config.go @@ -146,6 +146,10 @@ func GetConfigPath() string { return filepath.Dir(configFileUsed) } +func GetConfigFilePath() string { + return viper.ConfigFileUsed() +} + func GetStashPaths() []*models.StashConfig { var ret []*models.StashConfig if err := viper.UnmarshalKey(Stash, &ret); err != nil || len(ret) == 0 {