Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why toml? #958

Open
wroge opened this issue Nov 13, 2023 · 7 comments
Open

Why toml? #958

wroge opened this issue Nov 13, 2023 · 7 comments

Comments

@wroge
Copy link

wroge commented Nov 13, 2023

Thanks for the good work, I really like tegola to create vector tiles.
But I don't understand why you use toml for configuration.

I have a large number of configurations, so I use external tools to validate and generate the configuration. Many tools don't understand toml so I have to convert to json and then to toml. This leads to the problem that float values are converted to int values and toml can't handle that.

[[maps]]
...
center = [10.023321918554046, 52.44665611695578, 11]
...
type %!t(int64=11) could not be converted

Since tegola is written in go, it is very easy to accept other configuration formats such as json or yaml.
So the question is: why toml?

@wroge
Copy link
Author

wroge commented Nov 13, 2023

If I convert to yaml, I don't have this problem (so its a json thing). But the general question remains...

@ARolek
Copy link
Member

ARolek commented Nov 16, 2023

@wroge good question. We actually debated between JSON and TOML a bit early in the development of tegola and we opted for TOML as we expected config files to generally be authored by people instead of machines. TOML is easier to write by hand, and also supports comments which can be useful. YAML also has this capability, but TOML has less features than YAML so it's a bit more straight forward.

Recently we have had a few people reach out discussing how they're auto generating configs for tegola so this use case is more common than we anticipated. That considered, tegola's config layer currently parses TOML into a config struct, and this could be extended to support other config formats like JSON / YAML. Would you be interested in tackling this?

@wroge
Copy link
Author

wroge commented Nov 20, 2023

I will take a look at this.

EDIT: It's not that easy because env.Dict is used. It would therefore only be possible after refactoring.

@wroge
Copy link
Author

wroge commented Nov 23, 2023

An update to v1.3.2 would probably fix the Int-Float issue of he BurntSushi/toml package. But I dont dare to edit the modules.txt file 😩

@ARolek
Copy link
Member

ARolek commented Nov 24, 2023

@wroge want to give upgrading a try? If you clone the source code you can run the following from the repo root to upgrade:

go get -u <path to package>
go mod vendor
go mod tidy

You can then follow the build instructions.

@jchamberlain
Copy link
Contributor

FYI, in my fork I've already updated Tegola to use JSON in addition to TOML and we're using it in production right now. My work has been focused on updating our other systems that talk to Tegola, but I'll be back to finishing up my Tegola PRs later this month (dynamic config, config-in-redis, JSON config).

@VA7DBI
Copy link

VA7DBI commented Jul 4, 2024

FYI, in my fork I've already updated Tegola to use JSON in addition to TOML and we're using it in production right now. My work has been focused on updating our other systems that talk to Tegola, but I'll be back to finishing up my Tegola PRs later this month (dynamic config, config-in-redis, JSON config).

Any update on this? I have a use case where dynamic config would be very beneficial.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants