Credentials handling
Credentials handling covers access to protected resources (APIs, databases, cloud storage, Git).
Credentials can be supplied via environment variables or .dhcore.ini configuration files.
Environment variables
Set the variables in your shell or CI environment. Example:
Configuration file (.dhcore.ini)
You can also place credentials in the .dhcore.ini file under a profile. The file MUST be placed in user home directory. The file is structured as follows:
[DEFAULT]
current_environment = local
[local]
dhcore_endpoint = http://192.168.58.2:30180
aws_endpoint_url = http://192.168.58.2:30080
...
[other-env]
dhcore_endpoint = http://other-env:30180
aws_endpoint_url = http://other-env:30080
...
The current_environment field in the [DEFAULT] section selects which credentials profile the SDK will use. There can be multiple profiles (e.g., local, staging, production) and the profile name is user defined. You can use the dhcore CLI to manage profiles or the following SDK methods:
import digitalhub as dh
# To read the current set of credentials/profile
dh.get_current_environment()
# To change the current profile
dh.set_current_environment("other-env")
Credentials values
For the credentials fields and values, see each resource page below. Just note that git credentials are not stored in the .dhcore.ini file.
- API DHCore - Credentials and utilities for the DigitalHub platform API
- S3 storage - Credentials and utilities for S3 storage
- Databases - Credentials and utilities for SQL databases
- Git repositories - Credentials for Git repositories