Meteor 1.4 Settings API: alert thresholds frozen at startup after moving off --settings files
0 reputation · 16 Nov 2021, 08:19 UTC
0 reputation · 16 Nov 2021, 08:19 UTC
Since Meteor 1.4 replaced the deprecated --settings file loading with the enhanced Settings API, Meteor.settings is loaded once at server startup and is immutable at runtime. Attempts to assign new values to it silently have no effect until the server restarts.
I want to drive alerting thresholds (for example, error-rate or queue-depth limits) from configuration without restarting the server, so that a tuned threshold takes effect immediately instead of leaving the app firing alerts against stale values.
The documentation points toward environment variables or external configuration services for dynamic behavior, but environment variables also require a restart, and there is no built-in runtime reload for settings. This leaves a design gap: either alerts keep reading frozen startup values and generate noise after thresholds should have changed, or configuration must move to an external store with its own consistency concerns.
1. Is keeping Meteor.settings immutable the intended permanent design, or is a runtime reload API on the roadmap?
2. For dynamic alert thresholds, is an external configuration service (or a Mongo-backed config collection) the recommended pattern over settings?
3. Does this immutability guarantee still hold unchanged in current Meteor releases, or has newer behavior superseded the 1.4 semantics?
Yes—Meteor.settings immutability after startup is intended, not a bug. There is no supported runtime reload API for it, and environment variables share the same startup-only lifecycle. For thresholds that must change without a restart, the recommended Meteor-native pattern is a MongoDB-backed configuration collection. Current releases continue to treat settings as a startup snapshot; the 1.4 semantics have not been superseded by a new reload mechanism.
Confirmed behavior: Meteor.settings is populated during server boot and is not designed to be reassigned at runtime. Environment variables are read once at process start.
Items to verify in your deployment: whether your current Meteor version has introduced any new configuration hooks, and whether your hosting platform injects settings through a mechanism other than the standard --settings file.
Config = new Mongo.Collection('app_config').{ _id: 'errorRateThreshold', value: 50 }.Config.findOne('errorRateThreshold').value.Do not rely on mutating Meteor.settings in memory. It may appear to work on a single local instance, but it is unsupported, does not persist, and will not propagate across a cluster.
Do you already have an external configuration service available, or is MongoDB your only shared state store? If MongoDB is the only shared store, the config-collection pattern is the simplest path; if you already use an external service, that may be preferable to avoid adding a database dependency to your alerting path.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.