Closed mdimjasevic closed 5 years ago
How did you test lyft/ratelimit
s behavior? I tested it too and it seems to ignore dot-directories:
$ tree -a examples
examples
├── root -> root2
└── root2
└── ratelimit
└── config
└── .blah
└── config.yaml
$ RUNTIME_IGNOREDOTFILES=false \
RUNTIME_ROOT=examples/root \
RUNTIME_SUBDIRECTORY=ratelimit \
LOG_LEVEL=DEBUG \
bin/ratelimit
DEBU[0000] runtime changed. loading new snapshot at examples/root/ratelimit
DEBU[0000] runtime: processing examples/root/ratelimit
DEBU[0000] runtime: processing examples/root/ratelimit/config
DEBU[0000] runtime: processing examples/root/ratelimit/config/.blah
DEBU[0000] runtime: processing examples/root/ratelimit/config/.blah/config.yaml
DEBU[0000] runtime: adding key=config..blah.config.yaml value=---
domain: mongo_cps2
descriptors:
- key: database
value: default
rate_limit:
unit: hour
requests_per_unit: 4
uint=false
WARN[0000] connecting to redis on unix /var/run/nutcracker/ratelimit.sock with pool size 10
$ RUNTIME_IGNOREDOTFILES=true \
RUNTIME_ROOT=examples/root \
RUNTIME_SUBDIRECTORY=ratelimit \
LOG_LEVEL=DEBUG \
bin/ratelimit
DEBU[0000] runtime changed. loading new snapshot at examples/root/ratelimit
DEBU[0000] runtime: processing examples/root/ratelimit
DEBU[0000] runtime: processing examples/root/ratelimit/config
DEBU[0000] runtime: processing examples/root/ratelimit/config/.blah
WARN[0000] connecting to redis on unix /var/run/nutcracker/ratelimit.sock with pool size 10
How did you test
lyft/ratelimit
s behavior? I tested it too and it seems to ignore dot-directories:
I guess I had an example where the top-level directory given by the RUNTIME_ROOT
environment variable had a name starting with a dot, which lyft/ratelimit
happily loads rules from regardless of the RUNTIME_IGNOREDOTFILES
flag.
Ok, I'll update this PR per your observation.
@neongreen , at least one other PR of mine depends on this one so it'd be great if you can take a look again.
In case you're waiting on me – this can be merged.
This confirms that "Would it look at
.foo/bar.yaml
ifRUNTIME_IGNOREDOTFILES
is enabled?" has a positive answer. Ratelimit does the same.