Skip to main content
Version: 10.2.9

Use configuration file for DA Tools

Configuration file

If you want to use a configuration file, edit notebooks/da-pipelines.ini.example and store your access data there.

If you do this, you can use an instance of wftools.configuration.configs.INIConfig to read the file and pass it to different classes that require access to WorkFusion or other APIs.

If you don't pass it, or the configuration file doesn't have specific access data stored, you will be requested to provide the required access data. Once you provide the data, it is stored in the cofiguration instance, and you won't be asked for input again if it's needed.

For example, you can use:

from wftools.configuration.configs import INIConfig
from wftools.resources.gui import FilesystemResourceCreator

cfg = INIConfig()
FilesystemResourceCreator(cfg)

If da-pipelines.ini contains the key and value for LOCAL_DIR_PATH in the general section of the configuration, it is used for creating the filesystem resource. If the key is not present, you are prompted to input the value. If the value is correct (meaning you can create the Resource = the directory exists), you won't be prompted again for it if it's needed again. You can also create a resource without specifying the configuration file, for instance:

from wftools.resources.gui import FilesystemResourceCreator

FilesystemResourceCreator()

If you do this, you are prompted to input access data, and the data won't be stored in any configuration file for future use. It's a good way of accessing some ad-hoc resources for which you don't want to store access data in your configuration file.

In the configution file, you can also specify different profiles with random names. For example, to da-pipelines.ini, you can add a profile (section) named external_s3:

[external_s3]
S3_ENDPOINT=example.workfusion.com
S3_ACCESS_KEY=example_key
S3_SECRET_TOKEN=example_token
S3_BUCKET=example_bucket_name

Then, you can use the profile like this:

from wftools.configuration.configs import INIConfig
from wftools.resources.gui import FilesystemResourceCreator

cfg = INIConfig()
with cfg.enabled_profile("external_s3"):
FilesystemResourceCreator(cfg)

In the above case, the credentials from the external_s3 configuration profile are used for creating a filesystem resource.

Similarly to a default profile, if you enable a profile, and it doesn't have required access data, you are prompted to input it. After you provide the data (and they are correct), these data are stored inside the configuration file under the specified profile.

Sample da-pipelines.ini

Below you can see what the da-pipelines.ini file should look like. The file is located in the da-tools-windows-wftools-version-name\notebooks\version-name\ directory.

[general]
WF_ENDPOINT_URL=https://demo-102-wfaw-10010-workfusion-lb1.workfusion.com/workfusion (or any other)
WF_WORKFUSION_URL=https://demo-102-wfaw-10010-workfusion-lb1.workfusion.com/workfusion (or any other)
CT_URL=https://demo-102-wfaw-10010-workfusion-lb1.workfusion.com/workfusion (or any other)
WF_API_USERNAME=your_login_for_CT
WF_API_PASSWORD="your_password_for_CT"
WF_IGNORE_CERTIFICATES=y

S3_ENDPOINT=demo-102-wfaw-10010-minio-lb1.workfusion.com (or any other)
S3_ACCESS_KEY=JOZXPHL1ZC8WXZAJXNU7
S3_SECRET_TOKEN=qAEYOVLOViPjxk3Lbuj0wrDztf8fGJrqMb4Obw==
S3_BUCKET=doc-upload
S3_IGNORE_CERTIFICATES=true

#SHARED_DRIVE_USERNAME=CHANGEME
#SHARED_DRIVE_PASSWORD=CHANGEME
#SHARED_DRIVE_IP=CHANGEME
#SHARED_DRIVE_REMOTE_NAME=CHANGEME
#SHARED_DRIVE_DOMAIN=CHANGEME
#SHARED_DRIVE_SHARE=CHANGEME

LOCAL_FOLDER_EXPERIMENTS=experiments
LOCAL_DATA_DIR_PATH=CHANGEME

Example of an additional profile:

[external_s3]
S3_ENDPOINT=example.workfusion.com
S3_ACCESS_KEY=example_key
S3_SECRET_TOKEN=example_token
S3_BUCKET=example_bucket_name
S3_IGNORE_CERTIFICATES=false