hashicorp / hashicorp/hcl

Unnamed blocks?

Open
#249 3 comments 0 reactions 0 assignees View on GitHub
v1
Dominant language
Go
Stars
5.8k
Forks
657
Avg merge
20h 36m
Merged PRs (30d)
6

Description

I have the following type definitions:

```
type Config struct {
Init string
Host []HostConfig `hcl:"host"`
}

type HostConfig struct {
Services []Service `hcl:"service"`
}

type Service struct {
Name string `hcl:"name,key"`
PidFile string `hcl:"pid_file"`
}
```

This allows me to parse the following hcl:

```
init = "systemd"

host "foo" {
service "apache2" {
pid_file = "/var/run/apache2.pid"
}
service "ssh" {
pid_file = "/var/run/sshd.pid"
}
}
```

However the string that follows `host` is useless for me. Is it possible to parse a config file without it, i.e.

```
host {
...
}
```

Thanks.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.