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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to disable or rename the special type query parameter #1606

Open
dbluxo opened this issue Jan 25, 2023 · 7 comments
Open

Add ability to disable or rename the special type query parameter #1606

dbluxo opened this issue Jan 25, 2023 · 7 comments
Assignees
Milestone

Comments

@dbluxo
Copy link

dbluxo commented Jan 25, 2023

Hey 馃憢,

I'm trying to set a query parameter for an http datasource:

What works:

gomplate -d repos=https://<redacted>/api/repositories

What does not work:

gomplate -d repos=https://<redacted>/api/repositories?type=local

How to set ?type=local for the http datasource?

Thanks!

@kekscode
Copy link

I think this is an edge case: https://docs.gomplate.ca/datasources/#overriding-mime-types

@hairyhenderson
Copy link
Owner

@dbluxo can you clarify what "does not work" means here?

The type parameter is interpreted by gomplate to act as a media type hint for processing the result, so setting it to a non-MIME-type will probably break parsing.

This definitely feels like an unexpected edge-case, but it was bound to hit someone eventually 馃槗

@hairyhenderson
Copy link
Owner

I guess one workaround would be to use include instead of datasource/ds in your template to avoid parsing the data, and then parse it later specifically as the expected format with the appropriate data function.

For example:

{{ $parsed := include "repos" | data.JSON }}

@dbluxo
Copy link
Author

dbluxo commented Jan 26, 2023

can you clarify what "does not work" means here?

When I run it with ?type=local, I get the following error message:

17:01:35 ERR  error="failed to render template gomplate/template.yaml: template: gomplate/template.yaml:5:30: executing \"gomplate/template.yaml\" at <ds \"repos\">: error calling ds: Datasources of type local not yet supported"

I have now implemented it without ?type=local and perform the local repositories filtering in the template.

@hairyhenderson
Copy link
Owner

ok yeah - my assumption in #1606 (comment) stands then...

perhaps the type query parameter is something that could be disabled optionally...

@github-actions
Copy link

github-actions bot commented Apr 3, 2023

This issue is stale because it has been open for 60 days with no activity. Remove stale label or comment or this will be automatically closed in a few days.

@github-actions github-actions bot added the Stale label Apr 3, 2023
@hairyhenderson hairyhenderson self-assigned this Apr 3, 2023
@hairyhenderson hairyhenderson changed the title Http datasource: how to set a query parameter Add ability to disable or rename the special type query parameter Apr 3, 2023
@github-actions
Copy link

github-actions bot commented Jun 5, 2023

This issue is stale because it has been open for 60 days with no activity. Remove stale label or comment or this will be automatically closed in a few days.

@github-actions github-actions bot added the Stale label Jun 5, 2023
@hairyhenderson hairyhenderson added this to the v4.0.0 milestone Jun 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: To Do
Development

No branches or pull requests

3 participants