Skip to content

Commit

Permalink
YES
Browse files Browse the repository at this point in the history
  • Loading branch information
dmarticus committed Jan 24, 2025
1 parent d677c5d commit f3da199
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
4 changes: 3 additions & 1 deletion docker-compose.base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,12 @@ services:
args:
BIN: feature-flags
restart: on-failure
volumes:
- ./share:/share
environment:
WRITE_DATABASE_URL: 'postgres://posthog:posthog@db:5432/posthog'
READ_DATABASE_URL: 'postgres://posthog:posthog@db:5432/posthog'
MAXMIND_DATABASE_PATH: '/share/GeoLite2-City.mmdb'
MAXMIND_DB_PATH: '/share/GeoLite2-City.mmdb'
REDIS_URL: 'redis://redis:6379/'
ADDRESS: '0.0.0.0:3001'
SKIP_WRITES: 'false'
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@ services:
service: proxy
ports:
- 8010:8000
- 8000:8000
depends_on:
- replay-capture
- capture
- feature-flags
extra_hosts:
- 'web:host-gateway'
- 'host.docker.internal:host-gateway'
db:
extends:
file: docker-compose.base.yml
Expand Down
24 changes: 20 additions & 4 deletions rust/feature-flags/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,17 +126,33 @@ impl Config {
}

pub fn get_maxmind_db_path(&self) -> PathBuf {
if self.maxmind_db_path.is_empty() {
Path::new(env!("CARGO_MANIFEST_DIR"))
let path = if self.maxmind_db_path.is_empty() {
let manifest_dir = env!("CARGO_MANIFEST_DIR");
let default_path = Path::new(manifest_dir)
.parent()
.unwrap()
.parent()
.unwrap()
.join("share")
.join("GeoLite2-City.mmdb")
.join("GeoLite2-City.mmdb");

tracing::info!(
"No custom maxmind_db_path set. Using default path: {:?}",
default_path
);
default_path
} else {
PathBuf::from(&self.maxmind_db_path)
let custom_path = PathBuf::from(&self.maxmind_db_path);
tracing::info!("Using custom maxmind_db_path: {:?}", custom_path);
custom_path
};

tracing::info!("Checking if path exists: {:?}", path);
if !path.exists() {
tracing::error!("GeoIP database file not found at: {:?}", path);
}

path
}
}

Expand Down

0 comments on commit f3da199

Please sign in to comment.