Comments (8)
Yes, configuration will be scoped to the client, like this get_env(:the_app, __MODULE__, :registry_url)
and __MODULE__
will be resolved per-client.
I will open PR and mention you there 👍🏼
from avrora.
btw, I saw other issues dealing with compile time configuration and fixes. But I haven't seen anything related to fully runtime (startup) configuration
from avrora.
Hey @juanperi seems like there are some demand on runtime 😆
Since we have new configuration option otp_app: :name
I think we can extend its usage and take most of the settings if they set from the OTP app and if not – fallback to default value.
Then the chain would be
- If
otp_app
is set andschemas_path
is set – applyApplication.app_dir
- If
otp_app
is set andschemas_path
is not – takeApplication.get_env(<otp_app>, __MODULE__, :schemas_path
) - If
otp_app
is not set andschemas_path
is set – takeschemas_path
- If
otp_app
is not set andschemas_path
is not set – take default value
And the same-ish logic for rest options, WDYT?
from avrora.
that would still allow for 1 client for otp app, right?
What if instead we allow options to be passed when the start_link is called on the CustomAvroClient
?
children = [
{TheApp.AvroClient, [schemas_path: xxxx, registry_url: yyyyy]}
]
{:ok, pid} = Supervisor.start_link(children, strategy: :one_for_one)
That way, the initialization of the process will be able to pass the config, and make it fully independent of any compile time dependency, and allow you to have as many configurations as you need.
The usecase i have, is that I build a single docker image for QA and Prod. I need to point the client to point to QA when started in QA mode, and in production mode to a different schema.
The otp app might work in this case, but isn't it more straightforward and flexible to just pass the parameters when starting the supervision tree? The developer is in charge of where that config is coming from.
from avrora.
Yeah, initially the supervision tree args were complicated due to the Private client, but I guess I can take a look again into it. So will try that way
from avrora.
can you expand a bit in the complication?
from avrora.
Also with Application.get_env
I've suggested you still have control over environment, since you will be able to do it this way
# config/test.exs
config :the_app, TheApp.AvroClient,
registry_url: "http://xxx.xx"
defmodule TheApp.AvroClient do
use Avrora.Client,
otp_app: :the_app
end
because the resolution will happen in runtime, you can have different config per environment. I think it should work for you.
P.S Complications there because Avrora
is not running Avrora.Config
as a process to hold the config from supervision setup
from avrora.
you are totally correct. that would work if you automatically scope the config to the current client as in your last example, we could have multiple clients, with different configurations.
That would be good enough for having custom configurations per client
from avrora.
Related Issues (20)
- Empty user-agent in header when calling registry
- schema evolution support HOT 7
- hook to skip certain fields. HOT 2
- Fix warnings introduced in elixir 1.15 HOT 2
- logicalType: date HOT 5
- Telemetry support HOT 4
- Schema storage and reference lookup
- Confluent Schema Registry references
- Warnings on compilation HOT 4
- Maintain a CHANGELOG? HOT 5
- Dialyzer issues with private clients HOT 2
- "Messages encoded with OCF are wrapped in a List" what for? HOT 1
- Allow 3 named types to be used as root schemas
- Get schema name on decode HOT 3
- Add deprecation warning for encode with plain format
- Private clients hardcode schemas path at compile time HOT 6
- Option for decoding with tagged union values HOT 7
- unnamed_type error with primary type schema HOT 11
- Add option to enable SSL verification of registry requests
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from avrora.