-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for koios API registered user authentication (#1804)
## Description Implements environment variables and arrays: * variable: **KOIOS_API_TOKEN** * array: **KOIOS_API_HEADERS** 1. When variable **KOIOS_API_TOKEN** is a zero length or undefined string the array **KOIOS_API_HEADERS** gets instantiated but is empty. 2. When variable **KOIOS_API_TOKEN** is defined and not zero length the array **KOIOS_API_HEADERS** gets instantiated with `-H "'Authorization: Bearer ${KOIOS_API_TOKEN}'"`. Throughout all scripts which leverage KOIOS_API the headers: * When no other headers are used: * Passes along the Bearer token header for authentication via curl and any `echo`, `printl` or other debug/error statements. * When other headers are already used: * Array **HEADERS** is created from the array **KOIOS_API_HEADERS** and the existing headers are appended to the array. * This is to prevent altering the original KOIOS_API_HEADERS array for any subsequent calls to KOIOS during the same script execution * Passes along all headers for authentication via curl and any `echo`, `printl` or other debug/error statements. ## Motivation and context Nodes, and/or relays, which run Preview, Preprod, Guild, Sanchonet or Mainnet networks may end up using a single outbound IP address, for a number of reasons: * A single system running multiple (hopefully testnet) nodes/relays * Multiple servers behind a single NAT'd IP * Kubernetes environments where multiple pods have started on the same node * Also Edge deployments running containers on the same host. Even with multiple IP's and dedicated to a host some architectures may end up querying Koios using the same IP address which could exceed the daily limits. ## Which issue it fixes? None ## How has this been tested? Mostly testing via executing curl commands manually, have not generated a testing container in ghcr.io yet and loaded onto testnet stakepools and relays to confirm consistent behavior. While the PR is ready for review I would appreciate testing from the community to confirm everything appears to be working as expected. No rush to merge PR if the preferred reviewers and testers are unavailable for the time being. I'd rather have extensive testing and extended review periods than rush the merge. Thanks --------- Co-authored-by: RdLrT <[email protected]>
- Loading branch information
1 parent
90e1ca4
commit b6eb9de
Showing
3 changed files
with
36 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters