all repos — searchix @ 6d42ad10e483590d1dbb7ceacae8f6dd11f0d1df

Search engine for NixOS, nix-darwin, home-manager and NUR users

fix: unable to set log level from nixos module

Alan Pearce
commit

6d42ad10e483590d1dbb7ceacae8f6dd11f0d1df

parent

5c1454971ad761d7ee56a4d9a8b33f1e789dc9e3

4 files changed, 7 insertions(+), 10 deletions(-)

changed files
M cmd/searchix-web/main.gocmd/searchix-web/main.go
@@ -39,8 +39,6 @@ cfg, err = config.GetConfig(string(globalOptions.Config), logger.Named("config"))
if err != nil { return fault.Wrap(err, fmsg.With("Failed to parse config file")) } - - log.SetLevel(cfg.LogLevel) } if globalOptions.CPUProfile != "" {
M defaults.tomldefaults.toml
@@ -1,7 +1,5 @@
# Path to store index data. DataPath = './data' -# How much information to log, one of 'debug', 'info', 'warn', 'error', 'panic', 'fatal'. -LogLevel = 'info' # Settings for the web server [Web]
M internal/config/structs.gointernal/config/structs.go
@@ -9,14 +9,12 @@ "path/filepath"
"strings" "github.com/creasty/defaults" - "go.uber.org/zap/zapcore" ) type Config struct { - DataPath string `comment:"Path to store index data."` - LogLevel zapcore.Level `comment:"How much information to log, one of 'debug', 'info', 'warn', 'error', 'panic', 'fatal'."` - Web *Web `comment:"Settings for the web server"` - Importer *Importer `comment:"Settings for the import job"` + DataPath string `comment:"Path to store index data."` + Web *Web `comment:"Settings for the web server"` + Importer *Importer `comment:"Settings for the import job"` } type Web struct {
M nix/modules/default.nixnix/modules/default.nix
@@ -248,7 +248,10 @@ {
description = "Searchix Nix option search"; wantedBy = [ "multi-user.target" ]; path = with pkgs; [ nix ]; - inherit (cfg) environment; + environment = { + LOG_LEVEL = cfg.settings.logLevel; + } + // cfg.environment; serviceConfig = defaultServiceConfig // {