Skip to content

Commit 6ae4387

Browse files
committed
MAJOR: hcl: remove support
1 parent 9857cc4 commit 6ae4387

25 files changed

+222
-781
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ git clone https://github.com/haproxytech/dataplaneapi.git
2323
make build
2424
```
2525

26-
3\. You can find the built binary in /build directory.
26+
3\. You can find the built binary in /build directory. TEST
2727

2828
## Running the Data Plane API
2929
Basic usage:
@@ -72,7 +72,7 @@ HAProxy options:
7272
--backups-dir= Path to directory in which to place backup files
7373
-m, --master-runtime= Path to the master Runtime API socket
7474
-i, --show-system-info Show system info on info endpoint
75-
-f= Path to the dataplane configuration file (default: /etc/haproxy/dataplaneapi.hcl)
75+
-f= Path to the dataplane configuration file (default: /etc/haproxy/dataplaneapi.yaml)
7676
--userlist-file= Path to the dataplaneapi userlist file. By default userlist is read from HAProxy conf. When specified userlist would be read from this file
7777
--fid= Path to file that will dataplaneapi use to write its id (not a pid) that was given to him after joining a cluster
7878
-p, --maps-dir= Path to directory of map files managed by dataplane (default: /etc/haproxy/maps)

configuration/README.md

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,5 @@
22

33
## HAProxy Data Plane API configuration file
44

5-
you can select between two formats, yaml & hcl
6-
7-
examples can be seen [hcl](examples/example-dataplaneapi.hcl) and [yaml](examples/example-dataplaneapi.yaml)
8-
full examples of configuration also can be seen at [hcl](examples/example-full.hcl) and [yaml](examples/example-full.yaml)
9-
10-
## Converting between formats
11-
12-
you can convert from one format to another with
13-
14-
```bash
15-
go run configuration/converter/converter.go original.cfgfile.x converted.x
16-
```
5+
example can be seen [yaml](examples/example-dataplaneapi.yaml)
6+
full examples of configuration also can be seen at [yaml](examples/example-full.yaml)

configuration/configuration.go

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ type HAProxyConfiguration struct {
5151
BackupsDir string `long:"backups-dir" description:"Path to directory in which to place backup files" group:"transaction"`
5252
MapsDir string `short:"p" long:"maps-dir" description:"Path to directory of map files managed by dataplane" default:"/etc/haproxy/maps" group:"resources"`
5353
SpoeTransactionDir string `long:"spoe-transaction-dir" description:"Path to the SPOE transaction directory" default:"/tmp/spoe-haproxy" group:"resources"`
54-
DataplaneConfig string `short:"f" description:"Path to the dataplane configuration file" default:"/etc/haproxy/dataplaneapi.hcl" yaml:"-"`
54+
DataplaneConfig string `short:"f" description:"Path to the dataplane configuration file" default:"/etc/haproxy/dataplaneapi.yaml" yaml:"-"`
5555
ConfigFile string `short:"c" long:"config-file" description:"Path to the haproxy configuration file" default:"/etc/haproxy/haproxy.cfg" group:"haproxy"`
5656
Userlist string `short:"u" long:"userlist" description:"Userlist in HAProxy configuration to use for API Basic Authentication" default:"controller" group:"userlist"`
5757
MasterRuntime string `short:"m" long:"master-runtime" description:"Path to the master Runtime API socket" group:"haproxy"`
@@ -72,14 +72,14 @@ type HAProxyConfiguration struct {
7272
}
7373

7474
type User struct {
75-
Name string `long:"name" description:"User name" group:"user" hcl:"name,key" example:"admin"`
75+
Name string `long:"name" description:"User name" group:"user" example:"admin"`
7676
Password string `long:"password" description:"password" group:"user" example:"adminpwd"`
7777
Insecure bool `long:"insecure" description:"insecure password" group:"user" example:"true"`
7878
}
7979

8080
type APIConfiguration struct {
81-
APIAddress string `long:"api-address" description:"Advertised API address" group:"advertised" hcl:"address" example:"10.2.3.4" save:"true"`
82-
APIPort int64 `long:"api-port" description:"Advertised API port" group:"advertised" hcl:"port" example:"80" save:"true"`
81+
APIAddress string `long:"api-address" description:"Advertised API address" group:"advertised" yaml:"address" example:"10.2.3.4" save:"true"`
82+
APIPort int64 `long:"api-port" description:"Advertised API port" group:"advertised" yaml:"port" example:"80" save:"true"`
8383
}
8484

8585
type ClusterConfiguration struct {
@@ -156,7 +156,7 @@ type Configuration struct {
156156
ServiceDiscovery ServiceDiscovery `yaml:"-"`
157157
Users []User `yaml:"-"`
158158
APIOptions APIConfiguration `yaml:"-"`
159-
LogTargets log.Targets `yaml:"log_targets,omitempty" hcl:"log_targets" group:"log"`
159+
LogTargets log.Targets `yaml:"log_targets,omitempty" group:"log"`
160160
HAProxy HAProxyConfiguration `yaml:"-"`
161161
mutex sync.Mutex
162162
}
@@ -214,15 +214,11 @@ func (c *Configuration) Load() error {
214214
switch ext {
215215
case ".yml", ".yaml":
216216
c.storage = &StorageYML{}
217-
case ".hcl":
218-
c.storage = &StorageHCL{}
219217
default:
220218
if err = (&StorageYML{}).Load(c.HAProxy.DataplaneConfig); err == nil {
221219
c.storage = &StorageYML{}
222-
223220
break
224221
}
225-
c.storage = &StorageHCL{}
226222
}
227223
if err = c.storage.Load(c.HAProxy.DataplaneConfig); err != nil {
228224
if errors.Is(err, fs.ErrNotExist) {

0 commit comments

Comments
 (0)