feat: добавить генерацию image variants
- добавлен shared config presets, custom transforms и allowlist hosts - реализованы Backend endpoints для assets, presets и variants - добавлена orchestration через PostgreSQL, RabbitMQ, S3 и worker - обновлён Gateway read-through flow с L1 cache и корректным Vary: Accept - добавлена миграция resize_mode для variants lookup - обновлены dev scripts, env template, lockfile и документация
This commit is contained in:
@@ -1,19 +1,34 @@
|
||||
import { loadQueueTopologyFromEnv, type QueueTopology } from "@image-platform/queue"
|
||||
import { loadStorageConfigFromEnv, type StorageConfig } from "@image-platform/storage"
|
||||
|
||||
export type WorkerConfig = {
|
||||
imgproxyUpstream: URL
|
||||
prefetch: number
|
||||
queueTopology: QueueTopology
|
||||
rabbitmqUrl: string
|
||||
storage: StorageConfig
|
||||
}
|
||||
|
||||
export function loadWorkerConfig(env: NodeJS.ProcessEnv = process.env): WorkerConfig {
|
||||
return {
|
||||
imgproxyUpstream: new URL(getRequiredEnv(env, "IMGPROXY_UPSTREAM")),
|
||||
prefetch: parsePositiveInteger(env.WORKER_PREFETCH, 2),
|
||||
queueTopology: loadQueueTopologyFromEnv(env),
|
||||
rabbitmqUrl: env.RABBITMQ_URL ?? "amqp://image:image-password@localhost:5672/image_platform",
|
||||
rabbitmqUrl: getRequiredEnv(env, "RABBITMQ_URL"),
|
||||
storage: loadStorageConfigFromEnv(env),
|
||||
}
|
||||
}
|
||||
|
||||
function getRequiredEnv(env: NodeJS.ProcessEnv, name: string) {
|
||||
const value = env[name]
|
||||
|
||||
if (!value) {
|
||||
throw new Error(`${name} is required`)
|
||||
}
|
||||
|
||||
return value
|
||||
}
|
||||
|
||||
function parsePositiveInteger(value: string | undefined, fallback: number) {
|
||||
if (!value) {
|
||||
return fallback
|
||||
|
||||
Reference in New Issue
Block a user