~bayindirh/nudge

551738c188eb0b742561b7b2f5ddf34b35ff2323 — Hakan Bayindir 1 year, 1 month ago ebec628 v0.3.0
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.
3 files changed, 21 insertions(+), 11 deletions(-)

M CHANGELOG.md
M README.md
M src/nudge.go
M CHANGELOG.md => CHANGELOG.md +4 -0
@@ 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.

M README.md => README.md +8 -2
@@ 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

M src/nudge.go => src/nudge.go +9 -9
@@ 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, &notificationToSend)

	// 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, &notificationToSend)

	// 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.