Closed jaeyson closed 2 weeks ago
Fixes #26
Setting the credentials dynamically won't work since the Connection module by default is a struct (hence, compile time).
Connection
This also affects the test files of the library, since it relies on explicit connection string. Leaving it blank will throw an error.
To reproduce:
test
MIX_ENV=test iex -S mix
Application.put_all_env( ex_typesense: [ api_key: "xyz", host: "localhost", port: 8108, scheme: "http" ] )
ExTypesense.Connection.new
nil
Since the problem came from making the connection a struct, it defeats the purpose of making it dynamic (runtime). So we have to change it from struct to map.
Fixes #26
Problem
Setting the credentials dynamically won't work since the
Connection
module by default is a struct (hence, compile time).This also affects the test files of the library, since it relies on explicit connection string. Leaving it blank will throw an error.
To reproduce:
test
env:MIX_ENV=test iex -S mix
ExTypesense.Connection.new
Connection
struct field values returnsnil
.Workaround
Since the problem came from making the connection a struct, it defeats the purpose of making it dynamic (runtime). So we have to change it from struct to map.