Skip to content

Commit

Permalink
Merge pull request #77 from Nevon/enable-basic-auth-in-webhooks
Browse files Browse the repository at this point in the history
Allow setting webhook username and password
  • Loading branch information
jesperes authored Mar 1, 2024
2 parents 841a653 + 20ede80 commit e225a38
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
3 changes: 2 additions & 1 deletion sample_repo_configuration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ webhooks:
active: true
url: http://my_other_endpoint
configuration:
secret: !env MY_OTHER_SECRET
username: my_username
password: !env WEBHOOK_PASSWORD
events:
- pr:modified
5 changes: 4 additions & 1 deletion src/bec_webhook_t.erl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
, createdDate => pos_integer()
, updatedDate => pos_integer()
, active := boolean()
, configuration := #{ secret := binary() }
, configuration := #{ secret := binary()
, username := binary()
, password := binary()
}
, events := [binary()]
, name := binary()
, url := binary()
Expand Down
15 changes: 12 additions & 3 deletions test/bec_proper_gen.erl
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,19 @@ webhook_active() ->
webhook_secret() ->
non_empty(string_b()).

webhook_username() ->
non_empty(string_b()).

webhook_password() ->
non_empty(string_b()).

webhook_config() ->
?LET( Secret
, webhook_secret()
, #{ secret => Secret }).
?LET({Secret, Username, Password}
, {webhook_secret(), webhook_username(), webhook_password()}
, #{ secret => Secret
, username => Username
, password => Password
}).

webhook_event() ->
oneof([<<"pr:modified">>, <<"repo:refs_changed">>]).
Expand Down

0 comments on commit e225a38

Please sign in to comment.