Skip to content

Commit

Permalink
Use embedded configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
g41797 committed Nov 10, 2023
1 parent b073664 commit af03921
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 4 deletions.
35 changes: 34 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,14 @@ all messages with severity above 4 will be discarded.

syslogsidecar saves timestamps in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339) format

### Configuration
### Configuration folder

All configuration files of the process should be stored within on folder.
Path of this folder process receives via "--cf" flag in command line, e.g.:
```bash
./syslogproc -cf ./cmd/syslogproc/conf/
```
### syslog server configuration

Configuration of syslog server component of syslogsidecar is saved in the file syslogreceiver.json:
```json
Expand Down Expand Up @@ -356,6 +363,32 @@ Additional helper function - *syslogsidecar.AllTargets()*:
// and error for absent or wrong syslogconf.json file.
func AllTargets() ([]string, error)
```
## Embedding configuration files

syslogsidecar process can use embedded configuration files:
```go
import (
"embed"
.........
)

//go:embed conf
var embconf embed.FS

func main() {
............................
............................
cleanUp, _ := sidecar.UseEmbeddedConfiguration(&embconf)
defer cleanUp()
sidecar.Start(syslog2nats.NewConnector())
}

```
For this case content of **conf** subfolder embedded within process.
No needs for "--cf" flag in command line.

Any value in configuration file may be [overridden using environment variables](https://github.com/g41797/gonfig#gonfig-)


## Implementations are based on syslogsidecar

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/asaskevich/EventBus v0.0.0-20200907212545-49d423059eef
github.com/g41797/go-syslog v1.0.11
github.com/g41797/kissngoqueue v0.1.5
github.com/g41797/sputnik v0.0.17
github.com/g41797/sputnik v0.0.18
)

require (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ github.com/g41797/kissngoqueue v0.1.5 h1:UrnpxbjOnTnKj/EqpbLA9LjhYkHjnLWMZQqsz3A
github.com/g41797/kissngoqueue v0.1.5/go.mod h1:c1mGfrNWfEP2cHeX04Iji8qYGQevvUmZw5SPZM5M9Cs=
github.com/g41797/reuseport v0.4.5 h1:/cRUOykZ99RWdP2TRsoWtOqZVeR3BtEjD4ZQ6ucCpJ0=
github.com/g41797/reuseport v0.4.5/go.mod h1:YspHTQtcQs/c6t4geFSzo0TN13ZtUY6HOYPMKynuvpU=
github.com/g41797/sputnik v0.0.17 h1:HBDFPgpMBaZHD1YY5Vjtfy6IVVigq31lN6WmK3KmG48=
github.com/g41797/sputnik v0.0.17/go.mod h1:nhuXjBz9tK1Myi+LVaTpLodWdMuquayrdcgJO6O+5dA=
github.com/g41797/sputnik v0.0.18 h1:RpU77pS0bh37tMw2EdVtIHso3p9TFhD0MNCIpFPSXpc=
github.com/g41797/sputnik v0.0.18/go.mod h1:nhuXjBz9tK1Myi+LVaTpLodWdMuquayrdcgJO6O+5dA=
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
Expand Down

0 comments on commit af03921

Please sign in to comment.