Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Eddy Babetto <eddy.babetto@secomind.com>
  • Loading branch information
eddbbt committed Apr 11, 2024
1 parent f1c56e9 commit 38e0dea
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 83 deletions.
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
erlang 23.0.2
elixir 1.11.4-otp-23
elixir 1.15.7-otp-26
erlang 26.1
4 changes: 4 additions & 0 deletions lib/astarte_flow/auth/astarte_public_key_provider.ex
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ defmodule Astarte.Flow.Auth.AstartePublicKeyProvider do
require Logger

alias Astarte.Core.Realm
alias Astarte.Core.CQLUtils
alias Astarte.AppEngine.API.Config

@impl true
@spec fetch_public_key(realm :: String.t()) ::
Expand All @@ -31,6 +33,8 @@ defmodule Astarte.Flow.Auth.AstartePublicKeyProvider do
end

defp fetch_realm_public_key(conn, realm_name) do
realm_name = CQLUtils.realm_name_to_keyspace_name(realm_name, Config.astarte_instance_id!())

statement = """
SELECT blobAsVarchar(value)
FROM :realm_name.kv_store
Expand Down
6 changes: 6 additions & 0 deletions lib/astarte_flow/config.ex
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@ defmodule Astarte.Flow.Config do
os_env: "CASSANDRA_NODES",
type: XandraNodes

@envdoc "The astarte instance id to generate keyspaces with"
app_env :astarte_instance_id, :astarte_flow, :astarte_instance_id,
os_env: "ASTARTE_INSTANCE_ID",
default: "",
type: :binary

@doc "Returns the default amqp connection parameters"
@type ssl_option ::
{:cacertfile, String.t()}
Expand Down
4 changes: 1 addition & 3 deletions lib/astarte_flow/flows/flow.ex
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,7 @@ defmodule Astarte.Flow.Flows.Flow do
error ->
_ =
Logger.error(
"Could not start block #{inspect(block_module)} with opts #{inspect(block_opts)}: #{
inspect(error)
}"
"Could not start block #{inspect(block_module)} with opts #{inspect(block_opts)}: #{inspect(error)}"
)

{:error, :block_start_failed}
Expand Down
8 changes: 4 additions & 4 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ defmodule Astarte.Flow.MixProject do
[
app: :astarte_flow,
version: "0.1.0",
elixir: "~> 1.7",
elixir: "~> 1.15",
start_permanent: Mix.env() == :prod,
deps: deps(),
elixirc_paths: elixirc_paths(Mix.env()),
Expand Down Expand Up @@ -67,14 +67,14 @@ defmodule Astarte.Flow.MixProject do
defp deps do
[
{:astarte_device, github: "astarte-platform/astarte-device-sdk-elixir"},
{:astarte_core, github: "astarte-platform/astarte_core"},
{:astarte_core, github: "eddbbt/astarte_core", branch: "keyspace_feature", override: true},
{:cors_plug, "~> 2.0"},
{:cyanide, "~> 1.0"},
{:cyanide, "~> 2.0"},
{:certifi, "~> 2.5"},
{:tortoise, "~> 0.9"},
{:elixir_uuid, "~> 1.2"},
{:excoveralls, "~> 0.10", only: :test},
{:exjsonpath, "~> 0.9.0"},
{:exjsonpath, [env: :prod, git: "https://github.com/ispirata/exjsonpath.git"]},
{:exjsontemplate, github: "ispirata/exjsontemplate"},
{:ex_json_schema, "~> 0.7"},
{:gen_stage, "~> 0.14"},
Expand Down
Loading

0 comments on commit 38e0dea

Please sign in to comment.