Merge pull request #435 from wunter8/431-ntfy-pub-default-user-pass
`ntfy pub`: use `default-user` and `default-password` from `client.yml`
This commit is contained in:
		
						commit
						5dacd6f2c7
					
				
					 3 changed files with 8 additions and 1 deletions
				
			
		| 
						 | 
					@ -5,10 +5,14 @@
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# default-host: https://ntfy.sh
 | 
					# default-host: https://ntfy.sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Defaults below will be used when a topic does not have its own settings
 | 
					# Default username and password will be used with "ntfy publish" if no credentials are provided on command line
 | 
				
			||||||
 | 
					# Default username and password will be used with "ntfy subscribe" if no credentials are provided in subscription below
 | 
				
			||||||
 | 
					# For an empty password, use empty double-quotes ("")
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# default-user:
 | 
					# default-user:
 | 
				
			||||||
# default-password:
 | 
					# default-password:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Default command will execute after "ntfy subscribe" receives a message if no command is provided in subscription below
 | 
				
			||||||
# default-command:
 | 
					# default-command:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Subscriptions to topics and their actions. This option is primarily used by the systemd service,
 | 
					# Subscriptions to topics and their actions. This option is primarily used by the systemd service,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -160,6 +160,8 @@ func execPublish(c *cli.Context) error {
 | 
				
			||||||
			fmt.Fprintf(c.App.ErrWriter, "\r%s\r", strings.Repeat(" ", 20))
 | 
								fmt.Fprintf(c.App.ErrWriter, "\r%s\r", strings.Repeat(" ", 20))
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		options = append(options, client.WithBasicAuth(user, pass))
 | 
							options = append(options, client.WithBasicAuth(user, pass))
 | 
				
			||||||
 | 
						} else if conf.DefaultUser != "" && conf.DefaultPassword != nil {
 | 
				
			||||||
 | 
							options = append(options, client.WithBasicAuth(conf.DefaultUser, *conf.DefaultPassword))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if pid > 0 {
 | 
						if pid > 0 {
 | 
				
			||||||
		newMessage, err := waitForProcess(pid)
 | 
							newMessage, err := waitForProcess(pid)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -14,6 +14,7 @@ and the [ntfy Android app](https://github.com/binwiederhier/ntfy-android/release
 | 
				
			||||||
* Bump Go version to Go 18.x ([#422](https://github.com/binwiederhier/ntfy/issues/422))
 | 
					* Bump Go version to Go 18.x ([#422](https://github.com/binwiederhier/ntfy/issues/422))
 | 
				
			||||||
* Web: Strip trailing slash when subscribing ([#428](https://github.com/binwiederhier/ntfy/issues/428), thanks to [@raining1123](https://github.com/raining1123) for reporting, and [@wunter8](https://github.com/wunter8) for fixing)
 | 
					* Web: Strip trailing slash when subscribing ([#428](https://github.com/binwiederhier/ntfy/issues/428), thanks to [@raining1123](https://github.com/raining1123) for reporting, and [@wunter8](https://github.com/wunter8) for fixing)
 | 
				
			||||||
* Allow empty passwords in `client.yml` ([#374](https://github.com/binwiederhier/ntfy/issues/374), thanks to [@cyqsimon](https://github.com/cyqsimon) for reporting, and [@wunter8](https://github.com/wunter8) for fixing)
 | 
					* Allow empty passwords in `client.yml` ([#374](https://github.com/binwiederhier/ntfy/issues/374), thanks to [@cyqsimon](https://github.com/cyqsimon) for reporting, and [@wunter8](https://github.com/wunter8) for fixing)
 | 
				
			||||||
 | 
					* `ntfy pub` will now use default username and password from `client.yml` ([#431](https://github.com/binwiederhier/ntfy/issues/431), thanks to [@wunter8](https://github.com/wunter8) for fixing)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
**Documentation:**
 | 
					**Documentation:**
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue