NFIBrokerage / spear

A sharp EventStoreDB v20+ client backed by Mint :yum:
https://hex.pm/packages/spear
Apache License 2.0
85 stars 14 forks source link

fix: configuring the start_link opts without global config #88

Closed yordis closed 1 year ago

yordis commented 1 year ago

I tried the following:

defmodule Umbrella.Application do
  use Application

  @impl true
  def start(_type, _args) do
    children = [
      {Umbrella.EventStore.Client, connection_string: "esdb://localhost:2113?tls=true&tlsVerifyCert=false"}
    ]

    Supervisor.start_link(children, strategy: :one_for_one, name: Umbrella.Supervisor)
  end
end

WITHOUT configuring anything under config/* configuration files, thus, it failed because:

** (Mix) Could not start application umbrella: Umbrella.Application.start(:normal, []) returned an error: shutdown: failed to start child: Umbrella.EventStore.Client
    ** (EXIT) an exception was raised:
        ** (FunctionClauseError) no function clause matching in Keyword.merge/2
            (elixir 1.14.5) lib/keyword.ex:979: Keyword.merge(nil, [connection_string: "esdb://localhost:2113?tls=true&tlsVerifyCert=false"])
            (umbrella 0.1.0) lib/umbrella/event_store/client.ex:2: Umbrella.EventStore.Client.start_link/1
            (stdlib 5.0) supervisor.erl:420: :supervisor.do_start_child_i/3
            (stdlib 5.0) supervisor.erl:406: :supervisor.do_start_child/2
            (stdlib 5.0) supervisor.erl:390: anonymous fn/3 in :supervisor.start_children/2
            (stdlib 5.0) supervisor.erl:1256: :supervisor.children_map/4
            (stdlib 5.0) supervisor.erl:350: :supervisor.init_children/2
            (stdlib 5.0) gen_server.erl:962: :gen_server.init_it/2
yordis commented 1 year ago

Either this or force the config using fetch_env! (which I wouldn't recommend honestly)

yordis commented 1 year ago

@the-mikedavis do you mind giving me some love over here?

coveralls commented 1 year ago

Pull Request Test Coverage Report for Build a3e2bd96b6156044f5f028f296fd76e069669bf2-PR-88

Warning: This coverage report may be inaccurate.

We've detected an issue with your CI configuration that might affect the accuracy of this pull request's coverage report. To ensure accuracy in future PRs, please see these guidelines. A quick fix for this PR: rebase it; your next report should be accurate.


Files with Coverage Reduction New Missed Lines %
lib/spear/acl.ex 1 90.0%
lib/spear/connection/configuration.ex 1 96.77%
lib/spear/filter/checkpoint.ex 1 0.0%
lib/spear/grpc.ex 1 83.33%
lib/spear/position.ex 1 0.0%
lib/spear/scavenge.ex 1 0.0%
lib/spear/supported_rpc.ex 1 0.0%
lib/spear/uuid.ex 1 90.0%
lib/spear/filter.ex 2 93.33%
lib/spear/cluster_member.ex 3 0.0%
<!-- Total: 356 -->
Totals Coverage Status
Change from base Build 40d5f2f12eae2090e90d0d5e5cddf50329ff1222: -50.2%
Covered Lines: 350
Relevant Lines: 709

💛 - Coveralls