Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7bb22b9

Browse files
authored
feat: idgen via config (#530)
* feat: idgen* feat: idgen destination* feat: idgen delivery* feat: idgen event* feat: idgen installation* fix: unused import* test: remove uuid usage from test files* chore: rename idgen config* docs: generate config* chore: gofmt
1 parent23ddb55 commit7bb22b9

File tree

38 files changed

+650
-206
lines changed

38 files changed

+650
-206
lines changed

‎cmd/e2e/alert_test.go‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ import (
55
"net/http"
66
"time"
77

8-
"github.com/google/uuid"
98
"github.com/hookdeck/outpost/cmd/e2e/httpclient"
9+
"github.com/hookdeck/outpost/internal/idgen"
1010
"github.com/stretchr/testify/assert"
1111
"github.com/stretchr/testify/require"
1212
)
1313

1414
func (suite*basicSuite)TestConsecutiveFailuresAlert() {
15-
tenantID:=uuid.New().String()
16-
destinationID:=uuid.New().String()
15+
tenantID:=idgen.String()
16+
destinationID:=idgen.Destination()
1717
secret:="testsecret1234567890abcdefghijklmnop"
1818

1919
tests:= []APITest{
@@ -136,8 +136,8 @@ func (suite *basicSuite) TestConsecutiveFailuresAlert() {
136136
}
137137

138138
func (suite*basicSuite)TestConsecutiveFailuresAlertReset() {
139-
tenantID:=uuid.New().String()
140-
destinationID:=uuid.New().String()
139+
tenantID:=idgen.String()
140+
destinationID:=idgen.Destination()
141141
secret:="testsecret1234567890abcdefghijklmnop"
142142

143143
// Setup phase - same as before

‎cmd/e2e/api_test.go‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package e2e_test
33
import (
44
"net/http"
55

6-
"github.com/google/uuid"
76
"github.com/hookdeck/outpost/cmd/e2e/httpclient"
7+
"github.com/hookdeck/outpost/internal/idgen"
88
)
99

1010
func (suite*basicSuite)TestHealthzAPI() {
@@ -26,8 +26,8 @@ func (suite *basicSuite) TestHealthzAPI() {
2626
}
2727

2828
func (suite*basicSuite)TestTenantsAPI() {
29-
tenantID:=uuid.New().String()
30-
sampleDestinationID:=uuid.New().String()
29+
tenantID:=idgen.String()
30+
sampleDestinationID:=idgen.Destination()
3131
tests:= []APITest{
3232
{
3333
Name:"GET /:tenantID without auth header",
@@ -272,8 +272,8 @@ func (suite *basicSuite) TestTenantsAPI() {
272272
}
273273

274274
func (suite*basicSuite)TestDestinationsAPI() {
275-
tenantID:=uuid.New().String()
276-
sampleDestinationID:=uuid.New().String()
275+
tenantID:=idgen.String()
276+
sampleDestinationID:=idgen.Destination()
277277
tests:= []APITest{
278278
{
279279
Name:"PUT /:tenantID",
@@ -582,7 +582,7 @@ func (suite *basicSuite) TestDestinationsAPI() {
582582
Name:"DELETE /:tenantID/destinations/:destinationID with invalid destination ID",
583583
Request:suite.AuthRequest(httpclient.Request{
584584
Method:httpclient.MethodDELETE,
585-
Path:"/"+tenantID+"/destinations/"+uuid.New().String(),
585+
Path:"/"+tenantID+"/destinations/"+idgen.Destination(),
586586
}),
587587
Expected:APITestExpectation{
588588
Match:&httpclient.Response{
@@ -629,7 +629,7 @@ func (suite *basicSuite) TestDestinationsAPI() {
629629
}
630630

631631
func (suite*basicSuite)TestDestinationsListAPI() {
632-
tenantID:=uuid.New().String()
632+
tenantID:=idgen.String()
633633
tests:= []APITest{
634634
{
635635
Name:"PUT /:tenantID",
@@ -795,8 +795,8 @@ func (suite *basicSuite) TestDestinationsListAPI() {
795795
}
796796

797797
func (suite*basicSuite)TestDestinationEnableDisableAPI() {
798-
tenantID:=uuid.New().String()
799-
sampleDestinationID:=uuid.New().String()
798+
tenantID:=idgen.String()
799+
sampleDestinationID:=idgen.Destination()
800800
tests:= []APITest{
801801
{
802802
Name:"PUT /:tenantID",
@@ -1046,8 +1046,8 @@ func (suite *basicSuite) TestDestinationTypesAPI() {
10461046

10471047
func (suite*basicSuite)TestJWTAuthAPI() {
10481048
// Step 1: Create tenant and get JWT token
1049-
tenantID:=uuid.New().String()
1050-
destinationID:=uuid.New().String()
1049+
tenantID:=idgen.String()
1050+
destinationID:=idgen.Destination()
10511051

10521052
// Create tenant first using admin auth
10531053
createTenantTests:= []APITest{
@@ -1212,7 +1212,7 @@ func (suite *basicSuite) TestJWTAuthAPI() {
12121212
Name:"GET /wrong-tenant-id with JWT should fail",
12131213
Request:suite.AuthJWTRequest(httpclient.Request{
12141214
Method:httpclient.MethodGET,
1215-
Path:"/"+uuid.New().String(),
1215+
Path:"/"+idgen.String(),
12161216
},token),
12171217
Expected:APITestExpectation{
12181218
Match:&httpclient.Response{

‎cmd/e2e/configs/basic.go‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import (
88
"strings"
99
"testing"
1010

11-
"github.com/google/uuid"
1211
"github.com/hookdeck/outpost/internal/config"
12+
"github.com/hookdeck/outpost/internal/idgen"
1313
"github.com/hookdeck/outpost/internal/infra"
1414
"github.com/hookdeck/outpost/internal/redis"
1515
"github.com/hookdeck/outpost/internal/util/testinfra"
@@ -72,9 +72,9 @@ func Basic(t *testing.T, opts BasicOpts) config.Config {
7272

7373
// MQ overrides
7474
c.MQs.RabbitMQ.ServerURL=rabbitmqServerURL
75-
c.MQs.RabbitMQ.Exchange=uuid.New().String()
76-
c.MQs.RabbitMQ.DeliveryQueue=uuid.New().String()
77-
c.MQs.RabbitMQ.LogQueue=uuid.New().String()
75+
c.MQs.RabbitMQ.Exchange=idgen.String()
76+
c.MQs.RabbitMQ.DeliveryQueue=idgen.String()
77+
c.MQs.RabbitMQ.LogQueue=idgen.String()
7878

7979
// Test-specific overrides
8080
c.PublishMaxConcurrency=3

‎cmd/e2e/destwebhook_test.go‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import (
55
"net/http"
66
"time"
77

8-
"github.com/google/uuid"
98
"github.com/hookdeck/outpost/cmd/e2e/httpclient"
9+
"github.com/hookdeck/outpost/internal/idgen"
1010
)
1111

1212
// TestingT is an interface wrapper around *testing.T
@@ -15,13 +15,13 @@ type TestingT interface {
1515
}
1616

1717
func (suite*basicSuite)TestDestwebhookPublish() {
18-
tenantID:=uuid.New().String()
19-
sampleDestinationID:=uuid.New().String()
18+
tenantID:=idgen.String()
19+
sampleDestinationID:=idgen.Destination()
2020
eventIDs:= []string{
21-
uuid.New().String(),
22-
uuid.New().String(),
23-
uuid.New().String(),
24-
uuid.New().String(),
21+
idgen.Event(),
22+
idgen.Event(),
23+
idgen.Event(),
24+
idgen.Event(),
2525
}
2626
secret:="testsecret1234567890abcdefghijklmnop"
2727
newSecret:="testsecret0987654321zyxwvutsrqponm"
@@ -397,8 +397,8 @@ func (suite *basicSuite) TestDestwebhookPublish() {
397397
}
398398

399399
func (suite*basicSuite)TestDestwebhookSecretRotation() {
400-
tenantID:=uuid.New().String()
401-
destinationID:=uuid.New().String()
400+
tenantID:=idgen.String()
401+
destinationID:=idgen.Destination()
402402

403403
// Setup tenant
404404
resp,err:=suite.client.Do(suite.AuthRequest(httpclient.Request{
@@ -473,8 +473,8 @@ func (suite *basicSuite) TestDestwebhookSecretRotation() {
473473
}
474474

475475
func (suite*basicSuite)TestDestwebhookTenantSecretManagement() {
476-
tenantID:=uuid.New().String()
477-
destinationID:=uuid.New().String()
476+
tenantID:=idgen.String()
477+
destinationID:=idgen.Destination()
478478

479479
// First create tenant and get JWT token
480480
createTenantTests:= []APITest{
@@ -728,8 +728,8 @@ func (suite *basicSuite) TestDestwebhookTenantSecretManagement() {
728728
}
729729

730730
func (suite*basicSuite)TestDestwebhookAdminSecretManagement() {
731-
tenantID:=uuid.New().String()
732-
destinationID:=uuid.New().String()
731+
tenantID:=idgen.String()
732+
destinationID:=idgen.Destination()
733733
secret:="testsecret1234567890abcdefghijklmnop"
734734
newSecret:="testsecret0987654321zyxwvutsrqponm"
735735

‎docs/pages/references/configuration.mdx‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ Global configurations are provided through env variables or a YAML file. ConfigM
6868
|`GCP_PUBSUB_SERVICE_ACCOUNT_CREDENTIALS`| JSON string or path to a file containing GCP service account credentials for Pub/Sub. Required if GCP Pub/Sub is the chosen MQ provider and not running in an environment with implicit credentials (e.g., GCE, GKE).|`nil`| Conditional|
6969
|`GIN_MODE`| Sets the Gin framework mode (e.g., 'debug', 'release', 'test'). See Gin documentation for details.|`release`| No|
7070
|`HTTP_USER_AGENT`| Custom HTTP User-Agent string for outgoing webhook deliveries. If unset, a default (OrganizationName/Version) is used.|`nil`| No|
71+
|`IDGEN_DELIVERY_EVENT_PREFIX`| Prefix for delivery event IDs, prepended with underscore (e.g., 'dev_123'). Default: empty (no prefix)|`nil`| No|
72+
|`IDGEN_DELIVERY_PREFIX`| Prefix for delivery IDs, prepended with underscore (e.g., 'dlv_123'). Default: empty (no prefix)|`nil`| No|
73+
|`IDGEN_DESTINATION_PREFIX`| Prefix for destination IDs, prepended with underscore (e.g., 'dst_123'). Default: empty (no prefix)|`nil`| No|
74+
|`IDGEN_EVENT_PREFIX`| Prefix for event IDs, prepended with underscore (e.g., 'evt_123'). Default: empty (no prefix)|`nil`| No|
75+
|`IDGEN_TYPE`| ID generation type for all entities: uuidv4, uuidv7, nanoid. Default: uuidv4|`uuidv4`| No|
7176
|`LOG_BATCH_SIZE`| Maximum number of log entries to batch together before writing to storage.|`1000`| No|
7277
|`LOG_BATCH_THRESHOLD_SECONDS`| Maximum time in seconds to buffer logs before flushing them to storage, if batch size is not reached.|`10`| No|
7378
|`LOG_LEVEL`| Defines the verbosity of application logs. Common values: 'trace', 'debug', 'info', 'warn', 'error'.|`info`| No|
@@ -231,6 +236,23 @@ gin_mode: "release"
231236
# Custom HTTP User-Agent string for outgoing webhook deliveries. If unset, a default (OrganizationName/Version) is used.
232237
http_user_agent:""
233238

239+
idgen:
240+
# Prefix for delivery event IDs, prepended with underscore (e.g., 'dev_123'). Default: empty (no prefix)
241+
delivery_event_prefix:""
242+
243+
# Prefix for delivery IDs, prepended with underscore (e.g., 'dlv_123'). Default: empty (no prefix)
244+
delivery_prefix:""
245+
246+
# Prefix for destination IDs, prepended with underscore (e.g., 'dst_123'). Default: empty (no prefix)
247+
destination_prefix:""
248+
249+
# Prefix for event IDs, prepended with underscore (e.g., 'evt_123'). Default: empty (no prefix)
250+
event_prefix:""
251+
252+
# ID generation type for all entities: uuidv4, uuidv7, nanoid. Default: uuidv4
253+
type:"uuidv4"
254+
255+
234256
# Maximum number of log entries to batch together before writing to storage.
235257
log_batch_size:1000
236258

‎go.mod‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ require (
3232
github.com/google/go-cmpv0.7.0
3333
github.com/google/uuidv1.6.0
3434
github.com/hookdeck/outpost/sdks/outpost-gov0.4.0
35-
github.com/jackc/pgx/v5v5.7.2
35+
github.com/jackc/pgx/v5v5.7.6
3636
github.com/jmespath/go-jmespathv0.4.0
3737
github.com/joho/godotenvv1.5.1
38+
github.com/matoous/go-nanoid/v2v2.1.0
3839
github.com/mikestefanello/batcherv0.1.0
3940
github.com/pkg/errorsv0.9.1
4041
github.com/rabbitmq/amqp091-gov1.10.0
@@ -73,7 +74,7 @@ require (
7374
gocloud.devv0.39.0
7475
gocloud.dev/pubsub/rabbitpubsubv0.39.0
7576
golang.org/x/oauth2v0.22.0
76-
golang.org/x/syncv0.11.0
77+
golang.org/x/syncv0.13.0
7778
google.golang.org/apiv0.191.0
7879
google.golang.org/grpcv1.65.0
7980
gopkg.in/yaml.v3v3.0.1
@@ -217,12 +218,12 @@ require (
217218
go.uber.org/atomicv1.11.0// indirect
218219
go.uber.org/multierrv1.11.0// indirect
219220
golang.org/x/archv0.8.0// indirect
220-
golang.org/x/cryptov0.35.0// indirect
221+
golang.org/x/cryptov0.37.0// indirect
221222
golang.org/x/expv0.0.0-20231006140011-7918f672742d// indirect
222223
golang.org/x/modv0.21.0// indirect
223224
golang.org/x/netv0.36.0// indirect
224-
golang.org/x/sysv0.31.0// indirect
225-
golang.org/x/textv0.22.0// indirect
225+
golang.org/x/sysv0.32.0// indirect
226+
golang.org/x/textv0.24.0// indirect
226227
golang.org/x/timev0.6.0// indirect
227228
golang.org/x/xerrorsv0.0.0-20240716161551-93cc26a95ae9// indirect
228229
google.golang.org/genprotov0.0.0-20240812133136-8ffd90a71988// indirect

‎go.sum‎

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,8 +1068,8 @@ github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsI
10681068
github.com/jackc/pgpassfilev1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
10691069
github.com/jackc/pgservicefilev0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo=
10701070
github.com/jackc/pgservicefilev0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
1071-
github.com/jackc/pgx/v5v5.7.2 h1:mLoDLV6sonKlvjIEsV56SkWNCnuNv531l94GaIzO+XI=
1072-
github.com/jackc/pgx/v5v5.7.2/go.mod h1:ncY89UGWxg82EykZUwSpUKEfccBGGYq1xjrOpsbsfGQ=
1071+
github.com/jackc/pgx/v5v5.7.6 h1:rWQc5FwZSPX58r1OQmkuaNicxdmExaEz5A2DO2hUuTk=
1072+
github.com/jackc/pgx/v5v5.7.6/go.mod h1:aruU7o91Tc2q2cFp5h4uP3f6ztExVpyVv88Xl/8Vl8M=
10731073
github.com/jackc/puddle/v2v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo=
10741074
github.com/jackc/puddle/v2v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
10751075
github.com/jmespath/go-jmespathv0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
@@ -1119,6 +1119,8 @@ github.com/lyft/protoc-gen-star v0.6.1/go.mod h1:TGAoBVkt8w7MPG72TrKIu85MIdXwDuz
11191119
github.com/lyft/protoc-gen-star/v2v2.0.1/go.mod h1:RcCdONR2ScXaYnQC5tUzxzlpA3WVYF7/opLeUgcQs/o=
11201120
github.com/magiconair/propertiesv1.8.9 h1:nWcCbLq1N2v/cpNsy5WvQ37Fb+YElfq20WJ/a8RkpQM=
11211121
github.com/magiconair/propertiesv1.8.9/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
1122+
github.com/matoous/go-nanoid/v2v2.1.0 h1:P64+dmq21hhWdtvZfEAofnvJULaRR1Yib0+PnU669bE=
1123+
github.com/matoous/go-nanoid/v2v2.1.0/go.mod h1:KlbGNQ+FhrUNIHUxZdL63t7tl4LaPkZNpUULS8H4uVM=
11221124
github.com/mattn/go-isattyv0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
11231125
github.com/mattn/go-isattyv0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
11241126
github.com/mattn/go-isattyv0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
@@ -1406,8 +1408,8 @@ golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5y
14061408
golang.org/x/cryptov0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
14071409
golang.org/x/cryptov0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
14081410
golang.org/x/cryptov0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
1409-
golang.org/x/cryptov0.35.0 h1:b15kiHdrGCHrP6LvwaQ3c03kgNhhiMgvlhxHQhmg2Xs=
1410-
golang.org/x/cryptov0.35.0/go.mod h1:dy7dXNW32cAb/6/PRuTNsix8T+vJAqvuIy5Bli/x0YQ=
1411+
golang.org/x/cryptov0.37.0 h1:kJNSjF/Xp7kU0iB2Z+9viTPMW4EqqsrywMXLJOOsXSE=
1412+
golang.org/x/cryptov0.37.0/go.mod h1:vg+k43peMZ0pUMhYmVAWysMK35e6ioLh3wB8ZCAfbVc=
14111413
golang.org/x/expv0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
14121414
golang.org/x/expv0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
14131415
golang.org/x/expv0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
@@ -1586,8 +1588,8 @@ golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJ
15861588
golang.org/x/syncv0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
15871589
golang.org/x/syncv0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
15881590
golang.org/x/syncv0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
1589-
golang.org/x/syncv0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w=
1590-
golang.org/x/syncv0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
1591+
golang.org/x/syncv0.13.0 h1:AauUjRAJ9OSnvULf/ARrrVywoJDy0YS2AwQ98I37610=
1592+
golang.org/x/syncv0.13.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
15911593
golang.org/x/sysv0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
15921594
golang.org/x/sysv0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
15931595
golang.org/x/sysv0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -1678,8 +1680,8 @@ golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
16781680
golang.org/x/sysv0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
16791681
golang.org/x/sysv0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
16801682
golang.org/x/sysv0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
1681-
golang.org/x/sysv0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
1682-
golang.org/x/sysv0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
1683+
golang.org/x/sysv0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20=
1684+
golang.org/x/sysv0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
16831685
golang.org/x/termv0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
16841686
golang.org/x/termv0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
16851687
golang.org/x/termv0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
@@ -1691,8 +1693,8 @@ golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY=
16911693
golang.org/x/termv0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
16921694
golang.org/x/termv0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
16931695
golang.org/x/termv0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY=
1694-
golang.org/x/termv0.29.0 h1:L6pJp37ocefwRRtYPKSWOWzOtWSxVajvz2ldH/xi3iU=
1695-
golang.org/x/termv0.29.0/go.mod h1:6bl4lRlvVuDgSf3179VpIxBF0o10JUpXWOnI7nErv7s=
1696+
golang.org/x/termv0.31.0 h1:erwDkOK1Msy6offm1mOgvspSkslFnIGsFnxOKoufg3o=
1697+
golang.org/x/termv0.31.0/go.mod h1:R4BeIy7D95HzImkxGkTW1UQTtP54tio2RyHz7PwK0aw=
16961698
golang.org/x/textv0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
16971699
golang.org/x/textv0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
16981700
golang.org/x/textv0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -1711,8 +1713,8 @@ golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
17111713
golang.org/x/textv0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
17121714
golang.org/x/textv0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
17131715
golang.org/x/textv0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
1714-
golang.org/x/textv0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
1715-
golang.org/x/textv0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
1716+
golang.org/x/textv0.24.0 h1:dd5Bzh4yt5KYA8f9CJHCP4FB4D51c2c6JvN37xJJkJ0=
1717+
golang.org/x/textv0.24.0/go.mod h1:L8rBsPeo2pSS+xqN0d5u2ikmjtmoJbDBT1b7nHvFCdU=
17161718
golang.org/x/timev0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
17171719
golang.org/x/timev0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
17181720
golang.org/x/timev0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=

‎internal/app/app.go‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"time"
1212

1313
"github.com/hookdeck/outpost/internal/config"
14+
"github.com/hookdeck/outpost/internal/idgen"
1415
"github.com/hookdeck/outpost/internal/infra"
1516
"github.com/hookdeck/outpost/internal/logging"
1617
"github.com/hookdeck/outpost/internal/migrator"
@@ -56,6 +57,24 @@ func run(mainContext context.Context, cfg *config.Config) error {
5657
}
5758
logger.Info("starting outpost",logFields...)
5859

60+
// Initialize ID generators
61+
logger.Debug("configuring ID generators",
62+
zap.String("type",cfg.IDGen.Type),
63+
zap.String("event_prefix",cfg.IDGen.EventPrefix),
64+
zap.String("destination_prefix",cfg.IDGen.DestinationPrefix),
65+
zap.String("delivery_prefix",cfg.IDGen.DeliveryPrefix),
66+
zap.String("delivery_event_prefix",cfg.IDGen.DeliveryEventPrefix))
67+
iferr:=idgen.Configure(idgen.IDGenConfig{
68+
Type:cfg.IDGen.Type,
69+
EventPrefix:cfg.IDGen.EventPrefix,
70+
DestinationPrefix:cfg.IDGen.DestinationPrefix,
71+
DeliveryPrefix:cfg.IDGen.DeliveryPrefix,
72+
DeliveryEventPrefix:cfg.IDGen.DeliveryEventPrefix,
73+
});err!=nil {
74+
logger.Error("failed to configure ID generators",zap.Error(err))
75+
returnerr
76+
}
77+
5978
iferr:=runMigration(mainContext,cfg,logger);err!=nil {
6079
returnerr
6180
}

‎internal/app/installation.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package app
33
import (
44
"context"
55

6-
"github.com/google/uuid"
6+
"github.com/hookdeck/outpost/internal/idgen"
77
"github.com/hookdeck/outpost/internal/redis"
88
"github.com/hookdeck/outpost/internal/telemetry"
99
)
@@ -31,7 +31,7 @@ func getInstallation(ctx context.Context, redisClient redis.Cmdable, telemetryCo
3131
}
3232

3333
// Installation ID doesn't exist, create one atomically
34-
newInstallationID:=uuid.New().String()
34+
newInstallationID:=idgen.Installation()
3535

3636
// Use HSETNX to atomically set the installation ID only if it doesn't exist
3737
// This prevents race conditions when multiple Outpost instances start simultaneously

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp