Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.Flow.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
Loading