fix log + fix nginx undeployment command

This commit is contained in:
rmanach 2025-05-02 11:19:36 +02:00
parent a8b404cdce
commit 0581515de0
2 changed files with 9 additions and 3 deletions

View File

@ -202,7 +202,7 @@ func (nd *NginxDeployer) Destroy() (err error) {
_, err = nd.conn.Execute(
fmt.Sprintf(
"unlink /etc/nginx/sites-enabled/%s",
"rm -f /etc/nginx/sites-enabled/%s",
nginxConf,
),
)

10
main.go
View File

@ -210,10 +210,12 @@ func WithDestroy() InitOption {
func initLogger(debug bool) {
zerolog.TimeFieldFormat = zerolog.TimeFormatUnix
zerolog.SetGlobalLevel(zerolog.InfoLevel)
ctx := log.With()
if debug {
zerolog.SetGlobalLevel(zerolog.DebugLevel)
ctx = ctx.Caller()
}
log.Logger = log.With().Caller().Logger().Output(zerolog.ConsoleWriter{Out: os.Stderr})
log.Logger = ctx.Logger().Output(zerolog.ConsoleWriter{Out: os.Stderr})
}
// loadHMMap loads your instance configuration map from `$HOME/.homeserver` dir.
@ -510,5 +512,9 @@ func main() { //nolint: funlen // TODO: to reduce
Msg("unable to deploy project, see logs for details")
}
log.Info().Str("name", project.Name).Msg("project deployed successfully")
msg := "project deployed successfully"
if *destroy {
msg = "project undeployed successfully"
}
log.Info().Str("name", project.Name).Msg(msg)
}