Skip to content

Commit ebfbbf1

Browse files
committed
Allow encrypted_headers to be sent in via sequin config import
1 parent 08cb2d9 commit ebfbbf1

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

lib/sequin/transforms/transforms.ex

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -554,9 +554,11 @@ defmodule Sequin.Transforms do
554554
{:error, error} -> {:halt, {:error, error}}
555555
end
556556

557-
# Ignore encrypted_headers until encryption/decryption works
558557
"encrypted_headers" ->
559-
{:cont, {:ok, acc}}
558+
case parse_headers(value) do
559+
{:ok, headers} -> {:cont, {:ok, Map.put(acc, :encrypted_headers, headers)}}
560+
{:error, error} -> {:halt, {:error, error}}
561+
end
560562

561563
"webhook.site" ->
562564
if value in [true, "true"] do

test/sequin_web/controllers/yaml_controller_test.exs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ defmodule SequinWeb.YamlControllerTest do
44
alias Sequin.Databases.PostgresDatabase
55
alias Sequin.Databases.Sequence
66
alias Sequin.Test.UnboxedRepo
7+
alias Sequin.TestSupport.Models.Character
78
alias Sequin.TestSupport.ReplicationSlots
89

910
@moduletag :unboxed
@@ -120,7 +121,7 @@ defmodule SequinWeb.YamlControllerTest do
120121
- insert
121122
- update
122123
- delete
123-
source_table_name: accounts
124+
source_table_name: #{Character.table_name()}
124125
source_table_schema: public
125126
destination_table_name: sequin_events
126127
destination_table_schema: public
@@ -133,19 +134,18 @@ defmodule SequinWeb.YamlControllerTest do
133134
pool_size: 10
134135
username: postgres
135136
password: '********'
136-
database: sequin_example
137+
database: sequin_test
137138
slot_name: sequin_slot
138139
use_local_tunnel: false
139-
publication_name: sequin_pub
140+
publication_name: characters_publication
140141
http_endpoints:
141142
- name: test_http_endpoint
142143
url: http://localhost:4000/something
143144
headers: {}
144-
encrypted_headers: '(0 encrypted header(s)) - sha256sum: b4a8f200'
145145
sinks:
146146
- name: accounts_sink
147147
status: active
148-
table: public.accounts
148+
table: public.#{Character.table_name()}
149149
filters: []
150150
destination:
151151
port: 4222
@@ -164,7 +164,7 @@ defmodule SequinWeb.YamlControllerTest do
164164
- update
165165
- delete
166166
group_column_names:
167-
- user_id
167+
- id
168168
transforms:
169169
- name: record-transform
170170
type: path

test/support/models/character.ex

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ defmodule Sequin.TestSupport.Models.Character do
1717
timestamps(type: :naive_datetime_usec)
1818
end
1919

20+
def table_name do
21+
"Characters"
22+
end
23+
2024
def quoted_table_name do
2125
~s{"Characters"}
2226
end

0 commit comments

Comments
 (0)