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 (
|
from .model import (
|
||||||
AppConfig,
|
AppConfig,
|
||||||
AppSectionConfig,
|
AppSectionConfig,
|
||||||
|
DockerConfig,
|
||||||
HttpConfig,
|
HttpConfig,
|
||||||
LoggingConfig,
|
LoggingConfig,
|
||||||
MetricsConfig,
|
MetricsConfig,
|
||||||
|
|
@ -39,6 +40,7 @@ def load_config(
|
||||||
logging_section = _section(yaml_data, 'logging')
|
logging_section = _section(yaml_data, 'logging')
|
||||||
metrics_section = _section(yaml_data, 'metrics')
|
metrics_section = _section(yaml_data, 'metrics')
|
||||||
tracing_section = _section(yaml_data, 'tracing')
|
tracing_section = _section(yaml_data, 'tracing')
|
||||||
|
docker_section = _section(yaml_data, 'docker')
|
||||||
sandbox_section = _section(yaml_data, 'sandbox')
|
sandbox_section = _section(yaml_data, 'sandbox')
|
||||||
security_section = _section(yaml_data, 'security')
|
security_section = _section(yaml_data, 'security')
|
||||||
|
|
||||||
|
|
@ -130,6 +132,15 @@ def load_config(
|
||||||
enable_metrics=metrics_enabled,
|
enable_metrics=metrics_enabled,
|
||||||
enable_tracing=tracing_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),
|
sandbox=_load_sandbox_config(sandbox_section, env_values),
|
||||||
security=SecurityConfig(
|
security=SecurityConfig(
|
||||||
token_header=_yaml_or_env_str(
|
token_header=_yaml_or_env_str(
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,11 @@ class OtelConfig:
|
||||||
metric_export_interval: int
|
metric_export_interval: int
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(frozen=True, slots=True)
|
||||||
|
class DockerConfig:
|
||||||
|
base_url: str
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True, slots=True)
|
@dataclass(frozen=True, slots=True)
|
||||||
class SandboxConfig:
|
class SandboxConfig:
|
||||||
image: str
|
image: str
|
||||||
|
|
@ -68,5 +73,6 @@ class AppConfig:
|
||||||
metrics: MetricsConfig
|
metrics: MetricsConfig
|
||||||
tracing: TracingConfig
|
tracing: TracingConfig
|
||||||
otel: OtelConfig
|
otel: OtelConfig
|
||||||
|
docker: DockerConfig
|
||||||
sandbox: SandboxConfig
|
sandbox: SandboxConfig
|
||||||
security: SecurityConfig
|
security: SecurityConfig
|
||||||
|
|
|
||||||
|
|
@ -78,8 +78,8 @@ def build_container(
|
||||||
)
|
)
|
||||||
|
|
||||||
observability = build_observability(app_config)
|
observability = build_observability(app_config)
|
||||||
docker_client: DockerClient = docker.from_env()
|
|
||||||
clock = SystemClock()
|
clock = SystemClock()
|
||||||
|
docker_client = docker.DockerClient(base_url=app_config.docker.base_url)
|
||||||
|
|
||||||
user_repository = InMemoryUserRepository(
|
user_repository = InMemoryUserRepository(
|
||||||
observability.tracer, [User(id='123', email='aza@gglamer.ru', name='gglamer')]
|
observability.tracer, [User(id='123', email='aza@gglamer.ru', name='gglamer')]
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,9 @@ otel:
|
||||||
traces_endpoint: http://localhost:4318/v1/traces
|
traces_endpoint: http://localhost:4318/v1/traces
|
||||||
metric_export_interval: 1000
|
metric_export_interval: 1000
|
||||||
|
|
||||||
|
docker:
|
||||||
|
base_url: unix:///var/run/docker.sock
|
||||||
|
|
||||||
sandbox:
|
sandbox:
|
||||||
image: ai-agent:latest
|
image: ai-agent:latest
|
||||||
ttl_seconds: 300
|
ttl_seconds: 300
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue