Skip to content

Conversation

friofry
Copy link
Collaborator

@friofry friofry commented Jul 21, 2025

Key Changes

Yaml rules configuration instead of hardcoded lua dictionaries

Configuration Management

  • nginx-proxy/cache_rules.yaml - cache rules configuration
    • Network-specific TTL strategies (ethereum:mainnet, arbitrum:mainnet, etc.)
    • Method classifications (permanent, short, minimal)
    • Hierarchical configuration resolution: chain:networkchaindefault
    • Fractional ttl

Code Structure Refactoring

lua/
├── auth/           # Authentication modules  
├── cache/          # Caching system modules
├── providers/      # Provider management
├── utils/          # Utility functions
└── lua_tests/      # Tests powered by Busted framework

New Modules:

  • cache_rules.lua - Configuration engine with YAML integration
  • cache_rules_reader.lua - YAML parser with validation
  • Test suite with mock utilities

Docker & Configuration Changes

  • config.jsonauth_config.json
  • All configs moved to /app/ directory
  • Env vars:
    • CACHE_RULES_FILE/app/cache_rules.yaml
    • AUTH_CONFIG_FILE/app/auth_config.json

closes #55

@friofry friofry requested review from markoburcul and Copilot July 21, 2025 13:16
@friofry friofry marked this pull request as draft July 21, 2025 13:17
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the nginx-proxy caching system to use YAML-based configuration instead of hardcoded rules. The change enables dynamic cache rule management through external configuration files while maintaining backward compatibility.

  • Introduces YAML-based cache configuration system with cache_rules.yaml
  • Restructures Lua modules into organized subdirectories (auth/, cache/, utils/)
  • Adds comprehensive test suite with mock utilities for cache and nginx functionality

Reviewed Changes

Copilot reviewed 24 out of 26 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
nginx-proxy/nginx.conf Adds CACHE_RULES_FILE environment variable and updates module paths
nginx-proxy/cache_rules.yaml New YAML configuration defining cache rules and TTL defaults
nginx-proxy/lua/cache/*.lua New cache modules implementing YAML-based caching logic
nginx-proxy/lua_tests/* Comprehensive test suite with mocking utilities
docker-compose*.yml Updates volume mounts and config file paths
Dockerfiles Installs YAML dependencies and updates file paths
Comments suppressed due to low confidence (1)

nginx-proxy/lua_tests/test_utils/nginx_mocks.lua:19

  • [nitpick] The mock MD5 function returns a predictable hash based on string length, which may not adequately test hash collision scenarios. Consider using a more realistic mock that generates unique hashes.
            return "mock_hash_" .. string.len(str)

@friofry friofry marked this pull request as ready for review July 21, 2025 16:35
@friofry friofry mentioned this pull request Jul 21, 2025
Copy link
Contributor

@markoburcul markoburcul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few questions, but LGTM!

@friofry friofry force-pushed the ab/issue-55-yaml-cache-config branch from 53b4fb6 to 41e16d7 Compare July 28, 2025 17:47
@friofry friofry merged commit f140fdf into master Jul 28, 2025
2 checks passed
@friofry friofry deleted the ab/issue-55-yaml-cache-config branch July 28, 2025 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Store cache config in YAML format
2 participants