ConfigStore

Classin config_storefastly-compute 0.1.3View source

Extends FastlyResource[wit_config_store.Store].

Interface to Fastly Config Store.

Config Stores provide read-only access to configuration data that can be updated without redeploying your service.

with ConfigStore.open("app-config") as config:
api_url = config.get("api_url", "https://api.example.com")

Methods

__contains__

View source
__contains__(key: str) -> bool

Check if a key exists in the config store.

Parameters

key: str

The configuration key

Returns

bool

True if the key exists, False otherwise

Throws

config = ConfigStore.open("app-config")
if "feature_flag" in config:
print("Feature flag exists")
get(key: str, default: str | None = None) -> str | None

Get a configuration value.

Parameters

key: str

The configuration key

default: str | Noneoptional = None

Default value if key not found

Returns

str | None

Configuration value or default if not found

Throws

config = ConfigStore.open("app-config")
api_url = config.get("api_url", "https://api.example.com")

open

staticView source
open(name: str) -> Self

Open a config store by name.

Parameters

name: str

The name of the config store

Returns

Self

ConfigStore instance

Throws

config = ConfigStore.open("my-config")