The recommended way to set up nebula_graph_ex in your application.
Generates a NebulaGraphEx.Graph module scoped to your OTP app, adds a
default config block to config/config.exs, registers the module in your
application's supervision tree, and integrates NebulaGraphEx telemetry with
Phoenix telemetry metrics when available.
Usage
mix nebula_graph_ex.gen.graph MyApp.GraphThe module name becomes both the Elixir module and the registered connection pool name. Running the generator:
- Creates
lib/my_app/graph.ex— the graph module - Inserts a default config block into
config/config.exs - Injects the module as the first child in
lib/my_app/application.ex - Adds NebulaGraphEx metrics to
lib/my_app_web/telemetry.exwhen present - Adds LiveDashboard metrics wiring when a dashboard route is present
- Prints a
config/runtime.exssnippet for secrets
All three file modifications are idempotent — re-running the generator on an already-configured app skips each step that is already in place.
The file path for the graph module is derived automatically from the module
name. Use --path to override it if your project layout differs from the
standard convention:
mix nebula_graph_ex.gen.graph MyApp.Graph --path lib/my_app/connections/graph.exMultiple connections
Run the generator once per graph module:
mix nebula_graph_ex.gen.graph MyApp.PrimaryGraph
mix nebula_graph_ex.gen.graph MyApp.AnalyticsGraphEach module manages its own connection pool and reads its config from
Application.get_env(:my_app, MyApp.PrimaryGraph) independently.