---
url: /usecases/demos/environment-variables.md
description: >-
  Configure environment variables in Demo settings to pass Application
  credentials and other secrets to your deployed demo code.
---

# Set Environment Variables

If your demo requires environment variables (for instance, [Application credentials](../../services/applications)), you can set them in the**Settings** of your Demo.
You can access them in your code like regular environment variables, for example with `os.getenv()` in Python.

As an example, below is an excerpt of our [Gradio starter template](https://github.com/planqk/planqk-demo-starter-gradio):

```python
import os
from qhub.service.client import HubServiceClient

access_key_id = os.getenv('ACCESS_KEY_ID', None)
secret_access_key = os.getenv('SECRET_ACCESS_KEY', None)
service_endpoint = "https://gateway.hub.kipu-quantum.com/anaqor/quantum-random-number-generator/1.0.0"

def run(n_numbers: int):
    client = HubServiceClient(service_endpoint, access_key_id, secret_access_key)
    execution = client.run(request={"data": data, "params": params})
    execution.wait_for_final_state()
    result = execution.result()

    random_number_list = result["result"]["random_number_list"]
    return ", ".join([str(x) for x in random_number_list])
```

The code calls the [Quantum Random Number Generator Service](https://hub.kipu-quantum.com/marketplace/services/88b46e18-3d5f-4674-ba04-0d3416c0decd) using the [service-sdk](https://pypi.org/project/qhub-service).
The service is available as a free service on the Kipu Quantum Hub Marketplace.
To access the service, a [subscription to the service](../../services/using-a-service) is needed.
We can add the Access Key ID and Secret Access Key of the subscribed Application as environment variables to the Demo.
