Module configuration

Module configuration 

Source
Expand description

By default, all settings are loaded from files located under your home directory in the .qcs folder. Within that folder:

  • settings.toml will be used to load general settings (e.g. which URLs to connect to).
  • secrets.toml will be used to load tokens for authentication.

Both files should contain profiles. Your settings should contain a default_profile_name that determines which profile is loaded when no other profile is explicitly provided.

If you don’t have either of these files, see the QCS credentials guide for details on how to obtain them.

You can use environment variables to override values in your configuration:

  • SETTINGS_PATH_VAR: Set the path of the settings.toml file to load.
  • SECRETS_PATH_VAR: Set the path of the secrets.toml file to load.
  • SECRETS_READ_ONLY_VAR: Flag indicating whether to treat the secrets.toml file as read-only. Disabled by default.
    • Access token updates will not be persisted to the secrets file, regardless of file permissions, for any of the following values (case insensitive): “true”, “yes”, “1”.
    • Access token updates will be persisted to the secrets file if it is writeable for any other value or if unset.
  • PROFILE_NAME_VAR: Override the profile that is loaded by default
  • QUILC_URL_VAR: Override the URL used for requests to the quilc server.
  • QVM_URL_VAR: Override the URL used for requests to the QVM server.
  • API_URL_VAR: Override the URL used for requests to the QCS REST API server.
  • GRPC_API_URL_VAR: Override the URL used for requests to the QCS gRPC API.

The ClientConfiguration exposes an API for loading and accessing your configuration.

Structs§

AuthServer
Okta authorization server.
ClientConfiguration
A configuration suitable for use as a QCS API Client.
ClientConfigurationBuilder
Builder for ClientConfiguration.
ClientCredentials
A pair of Client ID and Client Secret, used to request an OAuth Client Credentials Grant
ExternallyManaged
A struct that manages access tokens by utilizing a user-provided refresh function.
OAuthSession
Manages the OAuth2 authorization process and token lifecycle for accessing the QCS API.
RefreshToken
A single type containing an access token and an associated refresh token.
TokenDispatcher
A wrapper for OAuthSession that provides thread-safe access to the inner tokens.

Enums§

ClientConfigurationBuilderError
Error type for ClientConfigurationBuilder
ConfigSource
Describes how a ClientConfiguration was initialized.
LoadError
Errors that can occur when loading a configuration.
OAuthGrant
Specifies the OAuth2 grant type to use, along with the data needed to request said grant type.
TokenError
Errors that can occur when managing authorization tokens.

Constants§

API_URL_VAR
Setting this environment variable will override the URL used to connect to the QCS REST API.
DEFAULT_API_URL
Default URL to access the QCS API.
DEFAULT_GRPC_API_URL
Default URL to access the gRPC API.
DEFAULT_PROFILE_NAME
Default profile name.
DEFAULT_QUILC_URL
Default URL to access quilc.
DEFAULT_QVM_URL
Default URL to access QVM.
DEFAULT_SECRETS_PATH
The default path that [Secrets] will be loaded from
DEFAULT_SETTINGS_PATH
The default path that [Settings] will be loaded from;
GRPC_API_URL_VAR
Setting this environment variable will override the URL used to connect to the GRPC server.
PROFILE_NAME_VAR
Setting this environment variable will change which profile is used from the loaded config files
QUILC_URL_VAR
Setting this environment variable will override the URL used to access quilc.
QVM_URL_VAR
Setting this environment variable will override the URL used to access the QVM.
SECRETS_PATH_VAR
Setting the QCS_SECRETS_FILE_PATH environment variable will change which file is used for loading secrets
SECRETS_READ_ONLY_VAR
QCS_SECRETS_READ_ONLY indicates whether to treat the secrets.toml file as read-only. Disabled by default.
SETTINGS_PATH_VAR
Setting the QCS_SETTINGS_FILE_PATH environment variable will change which file is used for loading [Settings].

Traits§

TokenRefresher
Get and refresh access tokens

Type Aliases§

RefreshFunction
A function that asynchronously refreshes a token.