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

CLI doesn't handle new KV store (and upcoming secret store) local server config #1319

Open
joeshaw opened this issue Sep 17, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@joeshaw
Copy link
Member

joeshaw commented Sep 17, 2024

Version

Fastly CLI version v10.14.1 (b392688)
Built with go version go1.22.7 linux/amd64 (2024-09-17)
Viceroy version: viceroy 0.12.1

What happened

Viceroy recently added support for loading KV store data from a file in fastly/Viceroy#365, and equivalent secret store support in fastly/Viceroy#428.

Previously in TOML you could specify entries like:

[local_server]
kv_stores.store_name = [{ key = "a_key", data = "hello world" }]

ie, an array. But now you can also define it as an object like so:

[local_server]
kv_stores.store_name = {file = "entries.json", format = "json"}

ie, an object. Secret store's syntax will be the same.

The CLI doesn't like this and throws an error:

✗ Verifying fastly.toml

ERROR: (0, 0): Can't convert file = "entries.json"
format = "json"
(*toml.Tree) to a tree.

This is probably because the struct definition for local_server tries to deserialize into a map[string][]LocalKVStore here: https://github.com/fastly/cli/blob/b3926881fe8d74598c72978a65ffa5d6c90a82b4/pkg/manifest/local_server.go. This probably needs to be changed to accept either a struct or a slice.

The workaround is to move these KV/secret store definitions to a separate toml file and run viceroy with them directly.

@joeshaw joeshaw added the bug Something isn't working label Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant