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

feat: Placeholders in source #139

Merged
merged 6 commits into from
Aug 5, 2024
Merged

feat: Placeholders in source #139

merged 6 commits into from
Aug 5, 2024

Conversation

shouya
Copy link
Owner

@shouya shouya commented Aug 5, 2024

This PR adds support for placeholders in the source url. This is useful for cases where the portion of source url is dynamic and can be specified when users request for the endpoint. The feature can be considered a pragmatic middle ground between static source and dynamic source.

Implements the feature request in #137.

Here's an example to demonstrate the usage:

endpoints:
  - path: /telegram.xml
    source:
      template: https://bridge.easter.fr/?action=display&bridge=TelegramBridge&username=${username}&format=Atom
      placeholders:
        username: {}
    filters: []

For each placeholders, you can define the default value and/or a validation regex:

endpoints:
  - path: /telegram.xml
    source:
      template: https://bridge.easter.fr/?action=display&bridge=TelegramBridge&username=${username}&format=Atom
      placeholders:
        username:
          validation: "^\\w+$"
          default: MANJULtoons
    filters: []

Then you can request the endpoint with the corresponding parameter like http://127.0.0.1:4080/telegram.xml?username=MANJULtoons.

NOTE: The Inspector UI for this particular source type is unsupported yet. I'm planning for a rewrite of the Inspector UI so before the rewrite the Inspector UI won't keep up with new features.

@shouya shouya linked an issue Aug 5, 2024 that may be closed by this pull request
@shouya shouya merged commit 313649a into master Aug 5, 2024
2 checks passed
@shouya shouya deleted the placeholders-in-source branch August 5, 2024 09:10
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

Successfully merging this pull request may close these issues.

Feature Request: Dynamic URL Configurations in Source Parameter
1 participant