cli
cli copied to clipboard
[FEATURE REQUEST] retain original formatting/structure of fastly.toml when the CLI wants to update the contents
Is your feature request related to a problem? Please describe. TOML files can be structured in many different ways, however when the Fastly CLI updates the contents of the fastly.toml file, it uses one specific format and does not attempt to use the original format of the file
Describe the solution you'd like I'd like the manifest.File.Write function to be aware of the original formatting of the manifest file and retain the same formatting when updating fields
Describe alternatives you've considered I can't think of any alternatives
Additional context
I'm not sure how many fields get updated by the CLI, the only one I know of is the root service_id field when a service is created or deleted.
Below is the original fastly.toml file structure I had in my project:
# This file describes a Fastly Compute@Edge package. To learn more visit:
# https://developer.fastly.com/reference/fastly-toml/
authors = ["[email protected]"]
description = "polyfill.io cdn implemented in javascript"
language = "javascript"
manifest_version = 2
name = "polyfill-service-c-at-e-example"
[local_server.backends.v3_eu]
url = "https://origami-polyfill-service-eu.herokuapp.com"
override_host = "origami-polyfill-service-eu.herokuapp.com"
[local_server.backends.v3_us]
url = "https://origami-polyfill-service-us.herokuapp.com"
override_host = "origami-polyfill-service-us.herokuapp.com"
[local_server.object_store]
bodies = []
headersAndStatus = []
[setup.backends.v3_eu]
address = "origami-polyfill-service-eu.herokuapp.com"
port = 443
[setup.backends.v3_us]
address = "origami-polyfill-service-us.herokuapp.com"
port = 443
After running fastly compute publish this is what the file looked like:
# This file describes a Fastly Compute@Edge package. To learn more visit:
# https://developer.fastly.com/reference/fastly-toml/
authors = ["[email protected]"]
description = "polyfill.io cdn implemented in javascript"
language = "javascript"
manifest_version = 2
name = "polyfill-service-c-at-e-example"
service_id = "5NhWgbEeqqUUaC7KeTh92K"
[local_server]
[local_server.backends]
[local_server.backends.v3_eu]
override_host = "origami-polyfill-service-eu.herokuapp.com"
url = "https://origami-polyfill-service-eu.herokuapp.com"
[local_server.backends.v3_us]
override_host = "origami-polyfill-service-us.herokuapp.com"
url = "https://origami-polyfill-service-us.herokuapp.com"
[setup]
[setup.backends]
[setup.backends.v3_eu]
address = "origami-polyfill-service-eu.herokuapp.com"
port = 443
[setup.backends.v3_us]
address = "origami-polyfill-service-us.herokuapp.com"
port = 443
Hi @JakeChampion this is a known issue and is caused by the toml parser we use.
If I remember correctly we have tried using alternative TOML parsers all of which effectively did the same thing and rewrote the TOML output into a more 'verbose' format.
I agree it's very annoying, but I'm currently unsure of an appropriate solution.