ConfigStore
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) -> boolCheck if a key exists in the config store.
Parameters
- key: str
The configuration key
Returns
bool
True if the key exists, False otherwise
Throws
- InvalidArgument — If the key is invalid
- KeyError — If the key is not a str
config = ConfigStore.open("app-config")if "feature_flag" in config: print("Feature flag exists")get
View sourceget(key: str, default: str | None = None) -> str | NoneGet 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
- InvalidArgument — If the key is invalid
config = ConfigStore.open("app-config")api_url = config.get("api_url", "https://api.example.com")Open a config store by name.
Parameters
- name: str
The name of the config store
Returns
Self
ConfigStore instance
Throws
- NotFound — If the config store doesn't exist
- InvalidSyntax — If the name is invalid
- NameTooLong — If the name is too long
config = ConfigStore.open("my-config")