From 551738c188eb0b742561b7b2f5ddf34b35ff2323 Mon Sep 17 00:00:00 2001 From: Hakan Bayindir Date: Tue, 17 Oct 2023 16:05:55 +0300 Subject: [PATCH] proj: Release v0.3.0. - proj: Release version 0.3.0. - proj: Bumped version to 0.3.0. - fix: Change a mistyped Debug to Debugf. - refactor: Did some code reorganization. --- CHANGELOG.md | 4 ++++ README.md | 10 ++++++++-- src/nudge.go | 18 +++++++++--------- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fed9d57..609d94e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ ## 2023-10-16 +- proj: Release version 0.3.0. +- proj: Bumped version to 0.3.0. +- fix: Change a mistyped `Debug` to `Debugf`. +- refactor: Did some code reorganization. - refactor: Remove logging level support from configuration file. - refactor: Remove logging relates examples from `nudge.conf.example`. - refactor: Logging file path support removed from `runTimeConfiguration` struct and `readAndApplyConfiguration` function. diff --git a/README.md b/README.md index 6fbea94..eff2e10 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,18 @@ **Current state:** Very alpha. Can be used reliably to send messages, but command line interface and configuration file is not stable. +**Current version:** 0.3.0 + nudge provides a small command line tool to send push notifications over [Pushover](https://pushover.net). It aims to provide a simple and composable tool to send push notifications. +## What's New + +- Since Zap doesn't allow log sink reconfiguration during runtime, all logging related configuration options are removed from the configuration file. Please use redirections to save your logs to files. Normal logs go to `stdout`, errors go to `stderr`. +- Log levels passed via command line are respected, but not applied immediately. If you're debugging for development, please change default options inside the code (see `applyDefaultConfiguration` function). +- You can override the location of your configuration file via command line. See `-help`. Doing this disables auto detection. Nudge will exit with an error if the file cannot be found or read. + ## Building After cloning the repository, going to `src/` folder and running `go build nudge.go` should do. @@ -66,8 +74,6 @@ Current options are as follows: ## Known Issues -- It's not possible to override configuration file location in this version. -- Logging subsystem is not configurable yet. Options in the configuration file are not handled. - Not all features provided by Pushover is implemented (image attachments, HTML formatting, and possibly others) ## Other Details diff --git a/src/nudge.go b/src/nudge.go index f77294d..528dcb8 100644 --- a/src/nudge.go +++ b/src/nudge.go @@ -117,7 +117,7 @@ func applyDefaultConfiguration(runtimeConfiguration *RuntimeConfiguration, notif // Let's set defaults for the application itself, again where it makes sense. applicationName := strings.Split(os.Args[0], "/") runtimeConfiguration.applicationName = applicationName[len(applicationName)-1] - runtimeConfiguration.version = "0.3.0a1" + runtimeConfiguration.version = "0.3.0" runtimeConfiguration.dryrun = false runtimeConfiguration.logLevel = "warn" } @@ -378,6 +378,13 @@ func main() { // Since there's no easy way to check whether a flag is set, I need a list of set flags. var setFlags []string + // Start by applying default configuration before building things up. + // Start with initializing valid configuration space. + initializeValidConfigurationOptions(&validConfigurationOptions) + + // Next, apply the defaults: + applyDefaultConfiguration(&runtimeConfiguration, ¬ificationToSend) + // Initialize Zap logger once and for all here. Because except log levels, Zap // doesn't support reconfiguration. For a completely reconfigurable variant, // there's Thales' flume (https://github.com/ThalesGroup/flume) @@ -420,13 +427,6 @@ func main() { sugaredLogger := logger.Sugar() sugaredLogger.Debugf("Logger is up.") - // Start by applying default configuration before building things up. - // Start with initializing valid configuration space. - initializeValidConfigurationOptions(&validConfigurationOptions) - - // Next, apply the defaults: - applyDefaultConfiguration(&runtimeConfiguration, ¬ificationToSend) - // Then let's see what we have at hand (options, parameters, flags). // Flags are parsed first, stored in a secondary config area. // This allows us to override config file with flags more gracefully. @@ -462,7 +462,7 @@ func main() { sugaredLogger.Panicf("Supplied log level %s is invalid, exiting.", runtimeConfiguration.logLevel) } - sugaredLogger.Debug("Logging level is changed to %s.", runtimeConfiguration.logLevel) + sugaredLogger.Debugf("Logging level is changed to %s.", runtimeConfiguration.logLevel) // Check whether our version is asked or not. // Version info shall always return clean. -- 2.45.2