Skip to main content

Config

from lium.sdk import Config

Defined in lium.sdk.config.

Config(
api_key: str,
base_url: str = 'https://lium.io/api',
ssh_key_path: Optional[pathlib.Path] = None,
workspace: Optional[str] = None,
workspace_id: Optional[str] = None,
workspace_explicit: bool = False,
session_token: Optional[str] = None,
api_key_source: str = 'explicit',
ssh_key_source: Optional[str] = None
)

Fields​

NameTypeDefault
api_keystr
base_urlstr'https://lium.io/api'
ssh_key_pathOptional[pathlib.Path]None
workspaceOptional[str]None
workspace_idOptional[str]None
workspace_explicitboolFalse
session_tokenOptional[str]None
api_key_sourcestr'explicit'
ssh_key_sourceOptional[str]None

Properties​

NameTypeDescription
api_key_fingerprintstr
api_key_descriptionstrkey <fingerprint> from <source> — what an auth error should name.
ssh_public_keysList[str]Get SSH public keys.

Methods​

MethodDescription
loadLoad config from env/file with smart defaults.

load​

def load(
cls,
workspace: Optional[str] = None,
*,
key_for_workspace: bool = True
) -> lium.sdk.config.Config:

Load config from env/file with smart defaults.

An explicitly requested workspace (workspace= or LIUM_WORKSPACE) means the key saved for it ([workspace.<name>] api_key) and nothing else: a key acts in exactly one workspace, so falling back to another key would run the command in another team on another balance; ValueError when none is saved. Otherwise, first match wins: LIUM_API_API_KEY / LIUM_API_KEY, the key saved for the workspace selected with lium workspaces use ([workspaces] active), [api] api_key. A config without workspace sections resolves as it always has.

key_for_workspace=False is for the commands that manage teams (lium workspaces, lium keys): a missing key for the requested workspace is not an error there — the key is LIUM_API_API_KEY / LIUM_API_KEY, else the one saved for the requested workspace, else the one saved for the stored default, else [api] api_key — so lium keys create … --save and LIUM_API_KEY=… lium workspaces use …, the remedies for a missing key, work with LIUM_WORKSPACE exported, and lium -w W workspaces members reads with W's key when one is saved.