MCPcopy Create free account
hub / github.com/Materials-Consortia/optimade-python-tools / ServerConfig

Class ServerConfig

optimade/server/config.py:168–599  ·  view source on GitHub ↗

This class stores server config parameters in a way that can be easily extended for new config file types.

Source from the content-addressed store, hash-verified

166
167
168class ServerConfig(BaseSettings):
169 """This class stores server config parameters in a way that
170 can be easily extended for new config file types.
171 """
172
173 model_config = SettingsConfigDict(
174 env_prefix="optimade_",
175 extra="allow",
176 env_file_encoding="utf-8",
177 case_sensitive=False,
178 validate_assignment=True,
179 )
180
181 debug: Annotated[
182 bool,
183 Field(
184 description="Turns on Debug Mode for the OPTIMADE Server implementation",
185 ),
186 ] = False
187
188 insert_test_data: Annotated[
189 bool,
190 Field(
191 description=(
192 "Insert test data into each collection on server initialisation. If true, "
193 "the configured backend will be populated with test data on server start. "
194 "Should be disabled for production usage."
195 ),
196 ),
197 ] = True
198
199 insert_from_jsonl: Annotated[
200 Path | None,
201 Field(
202 description=(
203 "The absolute path to an OPTIMADE JSONL file to use to initialize the database. "
204 "A unique index will be created over the ID to avoid duplication over multiple runs."
205 )
206 ),
207 ] = None
208
209 exit_after_insert: Annotated[
210 bool, Field(description="Exit the API after inserting data")
211 ] = False
212
213 create_default_index: Annotated[
214 bool,
215 Field(
216 description=(
217 "Whether to create a set of default indices "
218 "for supporting databases after inserting JSONL data."
219 )
220 ),
221 ] = False
222
223 gzip: Annotated[
224 GZipConfig,
225 Field(description="Configuration options for GZip compression."),

Callers 15

__init__Method · 0.90
create_appFunction · 0.90
create_loggerFunction · 0.90
main_index.pyFile · 0.90
main.pyFile · 0.90
__init__Method · 0.90
references.pyFile · 0.90
links.pyFile · 0.90
structures.pyFile · 0.90
mounted_clientFunction · 0.90
test_env_variableFunction · 0.90

Calls 3

ImplementationClass · 0.90
ProviderClass · 0.90
GZipConfigClass · 0.85

Tested by 13

mounted_clientFunction · 0.72
test_env_variableFunction · 0.72
test_default_config_pathFunction · 0.72
test_yaml_config_fileFunction · 0.72
test_wrong_versionFunction · 0.72
test_versioned_base_urlsFunction · 0.72