Skip to content

Commit b92a2c3

Browse files
committed
enforce presence of either webhooks or access token in secrets file
1 parent de0a287 commit b92a2c3

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/context.ml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,14 @@ let refresh_secrets ctx =
6767
match get_local_file path with
6868
| Error e -> fmt_error "error while getting local file: %s\nfailed to get secrets from file %s" e path
6969
| Ok file ->
70-
ctx.secrets <- Some (Config_j.secrets_of_string file);
71-
Ok ctx
70+
let secrets = Config_j.secrets_of_string file in
71+
begin
72+
match secrets.slack_access_token, secrets.slack_hooks with
73+
| None, [] -> fmt_error "either slack_access_token or slack_hooks must be defined in file '%s'" path
74+
| _ ->
75+
ctx.secrets <- Some secrets;
76+
Ok ctx
77+
end
7278

7379
let refresh_state ctx =
7480
match ctx.state_filepath with

0 commit comments

Comments
 (0)