Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
I'm deploying a python script API that will communicate with another (external) API, made by another department.
Both my team and the other team use separate Test/Acceptance/Production environments.
The url of the other team's API will change depending on the environment it is deployed in.
I'd like to change the url to call from within my Dataiku API depending on the current environment/infra, so both the DS API and the external API can match up through the delivery environments.
Is it possible for a python script API to somehow know which infra it's currently deployed in (through the python public API)? That way I could set up a mapping to the external url to call.
Operating system used: Windows
Hi,
The infra ID is not available from the API endpoint, but you can set you own env variables if these are static API nodes and retrieve via code:
import os
# get the value of a specific environment variable
env_var_value = os.environ.get("ENV_VAR_NAME")
Thanks
Thanks @AlexT
I figured something along those lines.
Where and how would I set those environment variables as global for an API node?
Hi,
For Static API nodes, you can include this in the DATADIR/bin/env-site.sh
by adding a line like :
export APINODE_INFRA_ID='your_infra_id'
Thanks