habitat-sh / habitat

Modern applications with built-in automation
https://www.habitat.sh
Apache License 2.0
2.6k stars 314 forks source link

Valid toml is invalid #6578

Open jsirex opened 5 years ago

jsirex commented 5 years ago

Sometimes using nested keys via dots is useful:

# YAML
spring:
  cloud:
   kafka:
     broker: broker-1

According to this: https://github.com/toml-lang/toml#keys it can be written as:

# TOML
sping.cloud.kafka.broker = "broker-1"

However validation is failed (by rq and also by tomlcheck). I believe they use same library.

Here is the test:

echo "foo.bar.baz = 125" | rq -t

If you have lots of nested keys dealing with sections may be nightmare:

[foo]
bar = 5
[foo.baz.banny]
x = "y"
z = "xxx"
[foo.baz.bar.fizz]
r = 6
[foo.baz.bar.fizzzz]
r = 7

This is either bug or we need to point to correct TOML syntax reference in documentation. Note, that habitat parses dotted configs correctly.

jsirex commented 5 years ago
   health-api: Writing configuration
   health-api: Writing service management scripts
   health-api: Using run hook /src/health-api/habitat/hooks/run
   health-api: Building package metadata
[ERROR] [rq] Encountered: expected an equals, found a period at line 19
[ERROR] [rq] (Re-run with --trace or RUST_BACKTRACE=1 for a backtrace)
   health-api: ERROR: Bad pkg_export in pkg_exposes; Value of key "app.server.port" does not contain a valid TCP or UDP port number: 
   health-api: Build time: 1m6s
   health-api: Exiting on error
christophermaier commented 5 years ago

@jsirex can you give some more detail on what's going on here? Are you running rq in a hook and it's choking on TOML that Habitat is otherwise parsing just fine?

jsirex commented 5 years ago

Create any package with default.toml:

web.http.port = 80

In plan.sh try export and expose the port. rq unable to parse such toml file: [ERROR] [rq] Encountered: expected an equals, found a period at line 19

christophermaier commented 5 years ago

Seems like rq and tomlcheck aren't adhering to the spec, then (which is odd, since rq is implemented in Rust and uses the same libraries that Habitat does 🤔)

As such, I don't think there's anything that we can do about this, apart from noting this in our documentation.

jsirex commented 4 years ago

@christophermaier, I checked rq version 1.0.2 and it seems to work.

jsirex commented 4 years ago

UPD: still issues with rq: https://github.com/dflemstr/rq/issues/206

mwrock commented 4 years ago

Closing here since the root cause appears to be elsewhere.

jsirex commented 4 years ago

It odd for me you're closing issue while habitat itself still does not work as expected.. Anyway this issue requires an action from habitat dev team...

mwrock commented 4 years ago

my apologies. You are correct. I missed a detail here. Reopening.

jsirex commented 4 years ago

Linking rq issue: https://github.com/dflemstr/rq/issues/208

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. We value your input and contribution. Please leave a comment if this issue still affects you.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. We value your input and contribution. Please leave a comment if this issue still affects you.