For AI agents: the complete documentation index is available at https://docs.dataplatform.ovh.net/llms.txt, the full documentation bundle is available at https://docs.dataplatform.ovh.net/llms-full.txt, and this page is available as Markdown at https://docs.dataplatform.ovh.net/developers-python-sdk-use-environment-variables.md.
  • 🇬🇧 English
  • Use environment variables in a Custom action

    Set environment variables for a Custom action in the preferences or in the JSON advanced mode

    Objective

    In a Custom action, you might want to use environment variables. You can set your own in the preferences or set them in the JSON Advanced Mode of the action, in the params JSON object, and re-use them in your custom action.

    import sys
    from logging import getLogger
    from forepaas.core.settings import PARAMS
    
    logger = logging.getLogger(__name__)
    
    def my_custom(event):
    	try:
    		# Show the parameter value
    		logger.info("Environment variable value is: ".format(PARAMS["env variable key"]))
    
    	except Exception as err: 
    		raise Exception("err:{} L:{}".format(err,sys.exc_info()[2].tb_lineno))

    Go further

    If you need training or technical assistance to implement our solutions, contact your sales representative or click on this link to get a quote and ask our Professional Services experts for a custom analysis of your project.

    Ask questions, give your feedback and interact directly with the team building the Data Platform on the dedicated Discord channel.

    If you need support with your OVHcloud services, create a request in our Help Centre.

    Join our community of users.