-
Notifications
You must be signed in to change notification settings - Fork 490
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
don't ask user to reload systemd service when running in docker (#3434)
* don't ask user to reload systemd service when running in docker * refactor + give appropriate message if terminal is attached * remove explicit filetype
- Loading branch information
Showing
16 changed files
with
51 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
# vim: set ft=dockerfile: | ||
FROM docker.io/golang:1.23-alpine3.20 AS build | ||
|
||
ARG BUILD_VERSION | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
# vim: set ft=dockerfile: | ||
FROM docker.io/golang:1.23-bookworm AS build | ||
|
||
ARG BUILD_VERSION | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
//go:build !windows && !freebsd && !linux | ||
|
||
package reload | ||
|
||
// generic message since we don't know the platform | ||
const message = "Please reload the crowdsec process for the new configuration to be effective." |
2 changes: 1 addition & 1 deletion
2
cmd/crowdsec-cli/reload/reload_freebsd.go → cmd/crowdsec-cli/reload/message_freebsd.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package reload | ||
|
||
// actually sudo is not that popular on freebsd, but this will do | ||
const Message = "Run 'sudo service crowdsec reload' for the new configuration to be effective." | ||
const message = "Run 'sudo service crowdsec reload' for the new configuration to be effective." |
2 changes: 1 addition & 1 deletion
2
cmd/crowdsec-cli/reload/reload_linux.go → cmd/crowdsec-cli/reload/message_linux.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package reload | ||
|
||
// assume systemd, although gentoo and others may differ | ||
const Message = "Run 'sudo systemctl reload crowdsec' for the new configuration to be effective." | ||
const message = "Run 'sudo systemctl reload crowdsec' for the new configuration to be effective." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package reload | ||
|
||
const message = "Please restart the crowdsec service for the new configuration to be effective." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,20 @@ | ||
//go:build !windows && !freebsd && !linux | ||
|
||
package reload | ||
|
||
// generic message since we don't know the platform | ||
const Message = "Please reload the crowdsec process for the new configuration to be effective." | ||
import ( | ||
"os" | ||
|
||
"github.com/crowdsecurity/go-cs-lib/version" | ||
isatty "github.com/mattn/go-isatty" | ||
) | ||
|
||
func UserMessage() string { | ||
if version.System == "docker" { | ||
if isatty.IsTerminal(os.Stdout.Fd()) || isatty.IsCygwinTerminal(os.Stdout.Fd()) { | ||
return "You may need to restart the container to apply the changes." | ||
} | ||
|
||
return "" | ||
} | ||
|
||
return message | ||
} |
This file was deleted.
Oops, something went wrong.