Selaa lähdekoodia

add commit hash and build date to the version logged when starting the daemon

Nicola Murino 5 vuotta sitten
vanhempi
commit
083d9f76c6
2 muutettua tiedostoa jossa 6 lisäystä ja 5 poistoa
  1. 2 2
      README.md
  2. 4 3
      service/service.go

+ 2 - 2
README.md

@@ -70,8 +70,6 @@ sftpgo -v
 SFTPGo version: 0.9.0-dev-90607d4-dirty-2019-08-08T19:28:36Z
 ```
 
-For Linux, a `systemd` sample [service](https://github.com/drakkan/sftpgo/tree/master/init/sftpgo.service "systemd service") can be found inside the source tree.
-
 Alternately you can use distro packages:
 
 - Several Arch Linux packages are available on AUR:
@@ -79,6 +77,8 @@ Alternately you can use distro packages:
   - [sftpgo-bin](https://aur.archlinux.org/packages/sftpgo-bin/). This package follow stable releases downloading the prebuilt linux binary from GitHub. It does not require `git`, `gcc` and `go` to build.
   - [sftpgo-git](https://aur.archlinux.org/packages/sftpgo-git/). This package build and install the latest git master. It requires `git`, `gcc` and `go` to build.
 
+For Linux, a `systemd` sample [service](https://github.com/drakkan/sftpgo/tree/master/init/sftpgo.service "systemd service") can be found inside the source tree.
+
 For macOS a `launchd` sample [service](https://github.com/drakkan/sftpgo/tree/master/init/com.github.drakkan.sftpgo.plist "launchd plist") can be found inside the source tree. The `launchd` plist assumes that `sftpgo` has `/usr/local/opt/sftpgo` as base directory.
 
 On Windows you can run `SFTPGo` as Windows Service, please read the "Configuration" section below for more details.

+ 4 - 3
service/service.go

@@ -35,9 +35,10 @@ func (s *Service) Start() error {
 		logLevel = zerolog.InfoLevel
 	}
 	logger.InitLogger(s.LogFilePath, s.LogMaxSize, s.LogMaxBackups, s.LogMaxAge, s.LogCompress, logLevel)
-	logger.Info(logSender, "", "starting SFTPGo "+utils.GetAppVersion().Version+", config dir: %v, config file: %v, log max size: %v log max backups: %v "+
-		"log max age: %v log verbose: %v, log compress: %v", s.ConfigDir, s.ConfigFile, s.LogMaxSize, s.LogMaxBackups, s.LogMaxAge,
-		s.LogVerbose, s.LogCompress)
+	version := utils.GetAppVersion()
+	logger.Info(logSender, "", "starting SFTPGo %v, config dir: %v, config file: %v, log max size: %v log max backups: %v "+
+		"log max age: %v log verbose: %v, log compress: %v", version.GetVersionAsString(), s.ConfigDir, s.ConfigFile, s.LogMaxSize,
+		s.LogMaxBackups, s.LogMaxAge, s.LogVerbose, s.LogCompress)
 	config.LoadConfig(s.ConfigDir, s.ConfigFile)
 	providerConf := config.GetProviderConf()