Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions src/models/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ class ServiceConfiguration(ConfigurationBase):
workers: PositiveInt = 1
color_log: bool = True
access_log: bool = True
tls_config: TLSConfiguration = TLSConfiguration()
cors: CORSConfiguration = CORSConfiguration()
tls_config: TLSConfiguration = Field(default_factory=TLSConfiguration)
cors: CORSConfiguration = Field(default_factory=CORSConfiguration)

@model_validator(mode="after")
def check_service_configuration(self) -> Self:
Expand Down Expand Up @@ -371,7 +371,7 @@ class JwkConfiguration(ConfigurationBase):
"""JWK configuration."""

url: AnyHttpUrl
jwt_configuration: JwtConfiguration = JwtConfiguration()
jwt_configuration: JwtConfiguration = Field(default_factory=JwtConfiguration)


class AuthenticationConfiguration(ConfigurationBase):
Expand Down Expand Up @@ -458,12 +458,14 @@ class Configuration(ConfigurationBase):
service: ServiceConfiguration
llama_stack: LlamaStackConfiguration
user_data_collection: UserDataCollection
database: DatabaseConfiguration = DatabaseConfiguration()
mcp_servers: list[ModelContextProtocolServer] = []
authentication: AuthenticationConfiguration = AuthenticationConfiguration()
database: DatabaseConfiguration = Field(default_factory=DatabaseConfiguration)
mcp_servers: list[ModelContextProtocolServer] = Field(default_factory=list)
authentication: AuthenticationConfiguration = Field(
default_factory=AuthenticationConfiguration
)
authorization: Optional[AuthorizationConfiguration] = None
customization: Optional[Customization] = None
inference: InferenceConfiguration = InferenceConfiguration()
inference: InferenceConfiguration = Field(default_factory=InferenceConfiguration)

def dump(self, filename: str = "configuration.json") -> None:
"""Dump actual configuration into JSON file."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ def test_authentication_configuration_module_unsupported() -> None:

def test_authentication_configuration_in_config() -> None:
"""Test the authentication configuration in main config."""
# pylint: disable=no-member
cfg = Configuration(
name="test_name",
service=ServiceConfiguration(),
Expand Down
1 change: 1 addition & 0 deletions tests/unit/models/config/test_tls_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def test_tls_configuration() -> None:

def test_tls_configuration_in_service_configuration() -> None:
"""Test the TLS configuration in service configuration."""
# pylint: disable=no-member
cfg = ServiceConfiguration(
tls_config=TLSConfiguration(
tls_certificate_path=Path("tests/configuration/server.crt"),
Expand Down