Merge pull request #12 from mozilla/3-dockerflow-env
Read GEOIP_DB_PATH from env (ref #4)
This commit is contained in:
Коммит
733f5b1c42
|
@ -17,6 +17,14 @@ This project should run on the latest stable version of Rust. Unstable features
|
|||
|
||||
A GeoIP database is required. For development purposes, one can be obtained from [the Maxmind website](https://dev.maxmind.com/geoip/geoip2/geolite2/). The GeoLite2 Country database is recommended. It should be placed at the root of the repository.
|
||||
|
||||
## Configuration
|
||||
|
||||
Via environment variables:
|
||||
|
||||
- `HOST`: host (default: `localhost`)
|
||||
- `PORT`: port number (default: `8080`)
|
||||
- `GEOIP_DB_PATH`: path to GeoIP database (default: `./GeoLite2-Country.mmdb`)
|
||||
|
||||
## Tests
|
||||
|
||||
Tests can be run with Cargo as well
|
||||
|
|
|
@ -31,7 +31,8 @@ fn main() {
|
|||
let sys = actix::System::new("classify-client");
|
||||
|
||||
let geoip = actix::SyncArbiter::start(1, || {
|
||||
let geoip_path = "./GeoLite2-Country.mmdb";
|
||||
let geoip_path =
|
||||
env::var("GEOIP_DB_PATH").unwrap_or_else(|_| "./GeoLite2-Country.mmdb".to_string());
|
||||
GeoIpActor::from_path(&geoip_path).unwrap_or_else(|err| {
|
||||
panic!(format!(
|
||||
"Could not open geoip database at {:?}: {}",
|
||||
|
|
Загрузка…
Ссылка в новой задаче