Print initialization errors to standard output

This way debugging configuration and initialization issues is simpler
This commit is contained in:
Nicola Murino
2019-07-31 08:14:31 +02:00
parent 8058178ea0
commit fab21dcf51
4 changed files with 43 additions and 4 deletions

View File

@@ -52,6 +52,7 @@ func (c Configuration) Initialize(configDir string) error {
utils.SetUmask(int(umask), c.Umask)
} else {
logger.Warn(logSender, "error reading umask, please fix your config file: %v", err)
logger.WarnToConsole("error reading umask, please fix your config file: %v", err)
}
actions = c.Actions
serverConfig := &ssh.ServerConfig{
@@ -78,6 +79,7 @@ func (c Configuration) Initialize(configDir string) error {
if _, err := os.Stat(filepath.Join(configDir, "id_rsa")); os.IsNotExist(err) {
logger.Info(logSender, "creating new private key for server")
logger.InfoToConsole("id_rsa does not exist, creating new private key for server")
if err := c.generatePrivateKey(configDir); err != nil {
return err
}