Skip to content

Commit

Permalink
Provide -TAGS= support for windows silent installer (#464)
Browse files Browse the repository at this point in the history
* Provide -TAGS= support for windows silent installer

Example usage:

`graylog_sidecar_installer_1.4.0-1.SNAPSHOT.exe /S -APITOKEN=myapitoken -TAGS=["IIS","exchange"]`

Please note that spaces in tags are not supported.

Fixes #460

* changelog
  • Loading branch information
mpfz0r authored Jan 10, 2023
1 parent af3d406 commit 5563609
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
6 changes: 6 additions & 0 deletions changelog/unreleased/pr-464.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
type = "added"
message = "Provide -TAGS= support for windows silent installer"

issues = ["460"]
pulls = ["464"]

5 changes: 5 additions & 0 deletions dist/chocolatey/graylog-sidecar.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
To properly configure the sidecar, you'll need to pass in your **server url** and your **api token**.

choco install graylog-sidecar --install-arguments="'-SERVERURL=http://10.0.2.2:9000/api -APITOKEN=yourapitoken'"

Other optional example parameters are:

-TAGS=["example","foo"] -NODENAME=mynodename -NODEID=1234 -SENDSTATUS=false -TLSSKIPVERIFY=true -UPDATEINTERVAL=10s

</description>
<releaseNotes></releaseNotes>
</metadata>
Expand Down
10 changes: 10 additions & 0 deletions dist/recipe.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
Var ParamSendStatus
Var ParamApiToken
Var ParamNodeId
Var ParamTags
Var Tags
Var NodeId
Var SendStatus
Var Dialog
Expand Down Expand Up @@ -227,6 +229,7 @@ Section "Post"
${GetOptions} $Params " -SEND_STATUS=" $ParamSendStatus
${GetOptions} $Params " -APITOKEN=" $ParamApiToken
${GetOptions} $Params " -NODEID=" $ParamNodeId
${GetOptions} $Params " -TAGS=" $ParamTags

${If} $ParamServerUrl != ""
StrCpy $ServerUrl $ParamServerUrl
Expand All @@ -249,6 +252,9 @@ Section "Post"
${If} $ParamNodeId != ""
StrCpy $NodeId $ParamNodeId
${EndIf}
${If} $ParamTags != ""
StrCpy $Tags $ParamTags
${EndIf}

; set defaults
${If} $ServerUrl == ""
Expand All @@ -267,6 +273,9 @@ Section "Post"
;sidecar.yml needs double escapes
${WordReplace} "file:$INSTDIR\node-id" "\" "\\" "+" $NodeId
${EndIf}
${If} $Tags == ""
StrCpy $Tags "[]"
${EndIf}

!insertmacro _ReplaceInFile "$INSTDIR\sidecar.yml" "<SERVERURL>" $ServerUrl
!insertmacro _ReplaceInFile "$INSTDIR\sidecar.yml" "<NODENAME>" $NodeName
Expand All @@ -275,6 +284,7 @@ Section "Post"
!insertmacro _ReplaceInFile "$INSTDIR\sidecar.yml" "<SENDSTATUS>" $SendStatus
!insertmacro _ReplaceInFile "$INSTDIR\sidecar.yml" "<APITOKEN>" $ApiToken
!insertmacro _ReplaceInFile "$INSTDIR\sidecar.yml" "<NODEID>" $NodeId
!insertmacro _ReplaceInFile "$INSTDIR\sidecar.yml" "<TAGS>" $Tags

;Install sidecar service
${If} $IsUpgrade == 'false'
Expand Down
9 changes: 9 additions & 0 deletions sidecar-windows-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ send_status: <SENDSTATUS>
# Default:
# windows_drive_range: "CDEFGHIJKLMNOPQRSTUVWXYZ"

# A list of tags to assign to this sidecar. Collector configuration matching any of these tags will automatically be
# applied to the sidecar.
# Default: []
tags: <TAGS>
# Example:
# tags:
# - apache-logs
# - dns-logs

# A list of binaries which are allowed to be executed by the Sidecar. An empty list disables the access list feature.
# Wildcards can be used, for a full pattern description see https://golang.org/pkg/path/filepath/#Match
# Example:
Expand Down

0 comments on commit 5563609

Please sign in to comment.