Skip to content

Commit 7a5c952

Browse files
committed
rename cfg_sources to cfg_origin
1 parent 9f03a43 commit 7a5c952

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

lib/context.ml

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
1+
open Devkit
2+
3+
let log = Log.from "context"
4+
15
exception Context_Error of string
26

37
type cfg_make_args =
48
| LocalMake of string
59
| RemoteMake of string * Github.t
610

7-
type cfg_sources =
11+
type cfg_origin =
812
| Local
913
| Remote
1014

1115
type data = {
1216
mutable cfg_path : string;
1317
mutable cfg_filename : string;
14-
cfg_source : cfg_sources;
18+
cfg_source : cfg_origin;
1519
cfg_action_after_refresh : Config.t -> unit;
1620
secrets_path : string;
1721
state_path : string;
@@ -45,6 +49,13 @@ let resolve_cfg_getter = function
4549
| Remote -> get_remote_cfg_json_url
4650

4751
let refresh_config ctx =
52+
( match ctx.data.cfg_source with
53+
| Local -> log#info "attempting to retrieve config locally"
54+
| Remote ->
55+
match ctx.secrets.gh_token with
56+
| None -> log#info "attempting to retrieve config remotely without gh_token"
57+
| Some _ -> log#info "attempting to retrieve config remotely with gh_token"
58+
);
4859
let getter = resolve_cfg_getter ctx.data.cfg_source in
4960
let%lwt cfg_json = getter ctx.data.cfg_path in
5061
ctx.cfg <- Config.make cfg_json ctx.secrets;

lib/context.mli

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ type cfg_make_args =
44
| LocalMake of string
55
| RemoteMake of string * Github.t
66

7-
type cfg_sources =
7+
type cfg_origin =
88
| Local
99
| Remote
1010

1111
type data = {
1212
mutable cfg_path : string;
1313
mutable cfg_filename : string;
14-
cfg_source : cfg_sources;
14+
cfg_source : cfg_origin;
1515
cfg_action_after_refresh : Config.t -> unit;
1616
secrets_path : string;
1717
state_path : string;

0 commit comments

Comments
 (0)