Re: Configuring multiple DataNodes

John Huss <[email protected]>
Newsgroups gmane.comp.java.cayenne.user
Message-ID <CAOUwSGvPHyW-Pzm=BWbMUaaOKTc4PkJ6DeO_ErZQVoAaOTpdHg@mail.gmail.com>
No, it supports System Properties passed to the Java process with
-Dproperty.name=value but not reading from environment variables directly.

On Fri, Apr 23, 2021 at 12:42 PM Tony Giaccone <[email protected]> wrote:

> Andrus,
>
> with these properties, you set an environment variable like this:
>
> $ export cayenne.jdbc.driver.eps.oracleDb=oracle.jdbc.OracleDriver
>
> and that sets the driver on that sdt of domain and node name?
>
>
> Tony
>
> On Fri, Apr 23, 2021 at 11:52 AM Andrus Adamchik <[email protected]>
> wrote:
>
> > also per-node connection params can be passed as properties:
> >
> >
> >
> https://cayenne.apache.org/docs/4.1/cayenne-guide/#appendix-a-configuration-properties
> > <
> >
> https://cayenne.apache.org/docs/4.1/cayenne-guide/#appendix-a-configuration-properties
> > >
> >
> >
> >
> > > On Apr 23, 2021, at 10:58 AM, John Huss <[email protected]> wrote:
> > >
> > > When you create your ServerRuntime you need to supply a custom DI
> module
> > to
> > > pass the DB connection parameters, something like this:
> > >
> > > *import* org.apache.cayenne.configuration.Constants;
> > >
> > > *import* org.apache.cayenne.di.Binder;
> > >
> > > *import* org.apache.cayenne.di.MapBuilder;
> > >
> > > *import* org.apache.cayenne.di.Module;
> > >
> > >
> > > *public* *class* MyModule *implements* Module {
> > >
> > > *public* *void* configure(Binder binder) {
> > >
> > > MapBuilder<String> mapBuilder = binder.bindMap(String.*class*,
> Constants.
> > > *PROPERTIES_MAP*);
> > >
> > > mapBuilder.put(Constants.*JDBC_URL_PROPERTY* +
> > > ".YourDataDomainName.YourDataNodeName", System.*getenv*("url"));
> > >
> > > ...
> > >
> > > }
> > >
> > > }
> > >
> > > On Fri, Apr 23, 2021 at 9:32 AM Tony Giaccone <[email protected]>
> wrote:
> > >
> > >> I have a datadomain with two datamaps, and two datasource each talking
> > to a
> > >> different database.
> > >>
> > >> Right now, I have had the datasource configured in the config file,
> but
> > I
> > >> need to remove that and set it programmatically, from an environment
> > >> variable.  Simple enough to do with a defauldata source, unclear how
> to
> > do
> > >> when you have multiple data sources and data nodes.
> > >>
> > >> After browsing through the code and the app as it's running, it's
> > unclear
> > >> to me how to do this.
> > >>
> > >> Does anyone know the secret sauce?
> > >>
> > >>
> > >>
> > >> Tony
> > >>
> >
> >
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.