514-labs / moose

The developer framework for your data & analytics stack
https://www.moosejs.com
MIT License
44 stars 8 forks source link

Attempt to use the docker container ID #1853

Closed cjus closed 1 month ago

cjus commented 1 month ago

Docker containers include a HOSTNAME environment variable that contains the short ID of the docker container. This PR introduces a one-line change:

let instance_id = std::env::var("HOSTNAME").unwrap_or_else(|_| Uuid::new_v4().to_string());

which will use the HOSTNAME if present; else, default to a UUID.

The reason for using this approach rather than our existing config crate and moose.config.toml is because we expect moose environment variables to be prefixed with MOOSE_ and the docker HOSTNAME environment variable, if present, will not have that prefix.

The usefulness of this approach is that we'll be able to tie moose usage of Redis keys to exact containers.

vercel[bot] commented 1 month ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
framework-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 29, 2024 0:48am
framework-landing ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 29, 2024 0:48am
moose-logs-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 29, 2024 0:48am
moose-product-analytics ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 29, 2024 0:48am