Bug fixes pipeline

This commit is contained in:
2026-02-09 16:59:48 +07:00
parent 07131f2d07
commit 8217818036
2 changed files with 6 additions and 9 deletions
+2 -8
View File
@@ -19,14 +19,8 @@ WORKDIR /app
COPY --from=builder /app/nats-ui ./
# config.yaml is in .gitignore; create default in image (override via volume at runtime)
RUN printf '%s\n' \
'nats_url: "nats://localhost:4222"' \
'subjects: ">"' \
'port: "8080"' \
'max_messages: 1000' \
> config.yaml
# Конфиг только внешний: не встраивается в образ. При запуске обязательно монтировать config.yaml:
# docker run -v /path/to/config.yaml:/app/config.yaml ...
RUN chmod +x nats-ui && chown -R appuser:appuser /app
EXPOSE 8080
+4 -1
View File
@@ -231,7 +231,7 @@ func extractProducerFromPayload(data []byte) string {
func loadConfig(filename string) (*Config, error) {
data, err := os.ReadFile(filename)
if err != nil {
return nil, fmt.Errorf("failed to read config file: %w", err)
return nil, err
}
var config Config
if err := yaml.Unmarshal(data, &config); err != nil {
@@ -259,6 +259,9 @@ func main() {
}
config, err := loadConfig(configFile)
if err != nil {
if os.IsNotExist(err) {
log.Fatalf("Config file not found: %s (config must be an external file). Create it or run: %s /path/to/config.yaml", configFile, os.Args[0])
}
log.Fatalf("Failed to load config: %v", err)
}
log.Printf("Loaded configuration from %s", configFile)