ref #8: [feat] add config for docker daemon
This commit is contained in:
parent
d2506e0c63
commit
3a7973accd
4 changed files with 21 additions and 1 deletions
|
|
@ -8,6 +8,7 @@ from dotenv import dotenv_values
|
|||
from .model import (
|
||||
AppConfig,
|
||||
AppSectionConfig,
|
||||
DockerConfig,
|
||||
HttpConfig,
|
||||
LoggingConfig,
|
||||
MetricsConfig,
|
||||
|
|
@ -39,6 +40,7 @@ def load_config(
|
|||
logging_section = _section(yaml_data, 'logging')
|
||||
metrics_section = _section(yaml_data, 'metrics')
|
||||
tracing_section = _section(yaml_data, 'tracing')
|
||||
docker_section = _section(yaml_data, 'docker')
|
||||
sandbox_section = _section(yaml_data, 'sandbox')
|
||||
security_section = _section(yaml_data, 'security')
|
||||
|
||||
|
|
@ -130,6 +132,15 @@ def load_config(
|
|||
enable_metrics=metrics_enabled,
|
||||
enable_tracing=tracing_enabled,
|
||||
),
|
||||
docker=DockerConfig(
|
||||
base_url=_yaml_or_env_str(
|
||||
docker_section,
|
||||
'base_url',
|
||||
'docker.base_url',
|
||||
env_values,
|
||||
'APP_DOCKER_BASE_URL',
|
||||
)
|
||||
),
|
||||
sandbox=_load_sandbox_config(sandbox_section, env_values),
|
||||
security=SecurityConfig(
|
||||
token_header=_yaml_or_env_str(
|
||||
|
|
|
|||
|
|
@ -40,6 +40,11 @@ class OtelConfig:
|
|||
metric_export_interval: int
|
||||
|
||||
|
||||
@dataclass(frozen=True, slots=True)
|
||||
class DockerConfig:
|
||||
base_url: str
|
||||
|
||||
|
||||
@dataclass(frozen=True, slots=True)
|
||||
class SandboxConfig:
|
||||
image: str
|
||||
|
|
@ -68,5 +73,6 @@ class AppConfig:
|
|||
metrics: MetricsConfig
|
||||
tracing: TracingConfig
|
||||
otel: OtelConfig
|
||||
docker: DockerConfig
|
||||
sandbox: SandboxConfig
|
||||
security: SecurityConfig
|
||||
|
|
|
|||
|
|
@ -78,8 +78,8 @@ def build_container(
|
|||
)
|
||||
|
||||
observability = build_observability(app_config)
|
||||
docker_client: DockerClient = docker.from_env()
|
||||
clock = SystemClock()
|
||||
docker_client = docker.DockerClient(base_url=app_config.docker.base_url)
|
||||
|
||||
user_repository = InMemoryUserRepository(
|
||||
observability.tracer, [User(id='123', email='aza@gglamer.ru', name='gglamer')]
|
||||
|
|
|
|||
|
|
@ -24,6 +24,9 @@ otel:
|
|||
traces_endpoint: http://localhost:4318/v1/traces
|
||||
metric_export_interval: 1000
|
||||
|
||||
docker:
|
||||
base_url: unix:///var/run/docker.sock
|
||||
|
||||
sandbox:
|
||||
image: ai-agent:latest
|
||||
ttl_seconds: 300
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue