Compare commits

..

3 commits

Author SHA1 Message Date
8eb2f4403e Add Consul token config
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline failed
Consul Token is used to provide a per-request ACL token
2025-01-18 16:49:12 +01:00
1d338a9cc1 fix consul version in ci
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/manual/woodpecker Pipeline was successful
2024-03-20 17:02:45 +00:00
e9bf550e02 Woodpecker CI 2024-03-20 17:02:45 +00:00
3 changed files with 9 additions and 12 deletions

View file

@ -1,7 +1,3 @@
---
kind: pipeline
name: bottin
steps:
- name: build
image: golang:stretch
@ -12,14 +8,8 @@ steps:
- go test -i -c -o test
- name: test_bottin
image: consul:latest
image: consul:1.15.4
environment:
BOTTIN_DEFAULT_ADMIN_PW: priZ4Cg0x5NkSyiIN/MpvWw4ZEy8f8s1
commands:
- ash test/runner.sh
---
kind: signature
hmac: ff246a04c3df8a2f39c8b446dea920622d61950e6caaac886931bdb05d0706ed
...

View file

@ -1,6 +1,6 @@
# Bottin
[![Build Status](https://drone.deuxfleurs.fr/api/badges/Deuxfleurs/bottin/status.svg?ref=refs/heads/main)](https://drone.deuxfleurs.fr/Deuxfleurs/bottin)
[![status-badge](https://woodpecker.deuxfleurs.fr/api/badges/38/status.svg)](https://woodpecker.deuxfleurs.fr/repos/38)
<img src="https://git.deuxfleurs.fr/Deuxfleurs/bottin/raw/branch/main/bottin.png" style="height: 150px; display: block; margin-left: auto; margin-right: auto" />
@ -87,6 +87,7 @@ suffix in the `suffix` key of the json config file.
By default, Bottin connects to the Consul server on localhost.
Change this by specifying the `consul_host` key in the json config file.
You may need a `consul_token` to connect to the Consul server.
### Bind addresses

View file

@ -40,6 +40,7 @@ type ConfigFile struct {
ConsulHost string `json:"consul_host"`
ConsulConsistent bool `json:"consul_force_consistency"`
ConsulToken string `json:"consul_token"`
Acl []string `json:"acl"`
@ -56,6 +57,7 @@ type Config struct {
ConsulHost string
ConsulConsistent bool
ConsulToken string
Acl ACL
@ -114,6 +116,7 @@ func readConfig(logger *log.Logger) Config {
ConsulHost: config_file.ConsulHost,
ConsulConsistent: config_file.ConsulConsistent,
ConsulToken: config_file.ConsulToken,
Acl: acl,
}
@ -168,6 +171,9 @@ func main() {
if config.ConsulHost != "" {
consul_config.Address = config.ConsulHost
}
if config.ConsulToken != "" {
consul_config.Token = config.ConsulToken
}
consul_client, err := consul.NewClient(consul_config)
if err != nil {
logger.Fatal(err)