You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is not uncommon for somebody to want to work with more than one instance of a single type of service. For example, migrating data from one instance of Time Series to a second instance of Time Series.
Both app1 and app2 will return the time series service instance as defined by app2.
What Happened?
To mimic behavior of Cloud Foundry VCAP services, the initialization of a Manifest app loads any environment variables into the runtime. The second app will overwrite those environment variables when the same type of service exists in both. For example, PREDIX_DATA_TIMESERIES_QUERY_URI from app2 will replace the value defined for app1.
When you call get_timeseries() the environment is inspected for VCAP or PREDIXPY environment variables to initialize the object.
Workaround
You can simply re-order operations to work around this.
My proposal is that there really should only be one app per process. When trying to initialize app2 an exception would be raised after detecting app1. This will prevent overwriting any envrionment variables.
An expectation was that when you wanted to use more than one service, the predix.app.Manifest() may not be the best fit. You can just initialize the underlying objects directly and pull environment variables from wherever it makes sense to you -- different environment variables, configuration files, magic, etc.
A second approach would be to create a new configuration system to be an alternative to the predix.app.Manifest(). Something like predix.app.CommonConfig() which would be a more complex configuration file but commonly shared by other language SDKs (java, javascript, etc.)
Community feedback is welcome.
The text was updated successfully, but these errors were encountered:
Context
It is not uncommon for somebody to want to work with more than one instance of a single type of service. For example, migrating data from one instance of Time Series to a second instance of Time Series.
Result
Both app1 and app2 will return the time series service instance as defined by app2.
What Happened?
To mimic behavior of Cloud Foundry VCAP services, the initialization of a Manifest app loads any environment variables into the runtime. The second app will overwrite those environment variables when the same type of service exists in both. For example,
PREDIX_DATA_TIMESERIES_QUERY_URI
from app2 will replace the value defined for app1.When you call
get_timeseries()
the environment is inspected for VCAP or PREDIXPY environment variables to initialize the object.Workaround
You can simply re-order operations to work around this.
How to fix it?
My proposal is that there really should only be one app per process. When trying to initialize app2 an exception would be raised after detecting app1. This will prevent overwriting any envrionment variables.
An expectation was that when you wanted to use more than one service, the
predix.app.Manifest()
may not be the best fit. You can just initialize the underlying objects directly and pull environment variables from wherever it makes sense to you -- different environment variables, configuration files, magic, etc.A second approach would be to create a new configuration system to be an alternative to the
predix.app.Manifest()
. Something likepredix.app.CommonConfig()
which would be a more complex configuration file but commonly shared by other language SDKs (java, javascript, etc.)Community feedback is welcome.
The text was updated successfully, but these errors were encountered: