-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce and use new API domain environment variables (#3822)
* Introduce and use new API domain environment variables * Print better error messages in example tests * Match host port inside container to simplify inner-container references * Fix ALLOWED_HOSTS port and remove duplicative `localhost` DEBUG entry * Fix nginx API host port * Update use of API_URL in API schema tests --------- Co-authored-by: Madison Swain-Bowden <bowdenm@spu.edu>
- Loading branch information
1 parent
9460b14
commit eae8c19
Showing
22 changed files
with
100 additions
and
119 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import os | ||
|
||
|
||
TOKEN = os.getenv("REQUEST_TOKEN", "<Openverse API token>") | ||
DOMAIN = os.getenv("CANONICAL_DOMAIN") | ||
_proto = "http" if "localhost" in DOMAIN else "https" | ||
ORIGIN = f"{_proto}://{DOMAIN}" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,28 @@ | ||
import os | ||
from api.examples.environment import ORIGIN, TOKEN | ||
|
||
|
||
token = os.getenv("AUDIO_REQ_TOKEN", "DLBYIcfnKfolaXKcmMC8RIDCavc2hW") | ||
origin = os.getenv("AUTH_REQ_ORIGIN", "https://api.openverse.engineering") | ||
|
||
auth = f'-H "Authorization: Bearer {token}"' if token else "" | ||
auth = f'-H "Authorization: Bearer {TOKEN}"' if TOKEN else "" | ||
|
||
auth_register_curl = f""" | ||
# Register for a key | ||
curl \\ | ||
-X POST \\ | ||
-H "Content-Type: application/json" \\ | ||
-d '{{"name": "My amazing project", "description": "To access Openverse API", "email": "user@example.com"}}' \\ | ||
"{origin}/v1/auth_tokens/register/" | ||
"{ORIGIN}/v1/auth_tokens/register/" | ||
""" # noqa: E501 | ||
|
||
auth_token_curl = f""" | ||
# Get an access token token | ||
curl \\ | ||
-X POST \\ | ||
-H "Content-Type: application/x-www-form-urlencoded" \\ | ||
-d 'grant_type=client_credentials&client_id=pm8GMaIXIhkjQ4iDfXLOvVUUcIKGYRnMlZYApbda&client_secret=YhVjvIBc7TuRJSvO2wIi344ez5SEreXLksV7GjalLiKDpxfbiM8qfUb5sNvcwFOhBUVzGNdzmmHvfyt6yU3aGrN6TAbMW8EOkRMOwhyXkN1iDetmzMMcxLVELf00BR2e' \\ | ||
"{origin}/v1/auth_tokens/token/" | ||
-d 'grant_type=client_credentials&client_id=<Openverse API client ID>&client_secret=<Openverse API client secret>' \\ | ||
"{ORIGIN}/v1/auth_tokens/token/" | ||
""" # noqa: E501 | ||
|
||
auth_key_info_curl = f""" | ||
curl \\ | ||
{auth} \\ | ||
"{origin}/v1/rate_limit/" | ||
"{ORIGIN}/v1/rate_limit/" | ||
""" |
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
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
Oops, something went wrong.