Skip to content

Commit 9703f7f

Browse files
committed
Improve the nimble options
1 parent 9a85ba6 commit 9703f7f

1 file changed

Lines changed: 22 additions & 6 deletions

File tree

  • lib/remote_persistent_term/fetcher

lib/remote_persistent_term/fetcher/s3.ex

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,31 @@ defmodule RemotePersistentTerm.Fetcher.S3 do
66

77
@behaviour RemotePersistentTerm.Fetcher
88

9+
@type bucket :: String.t()
10+
@type region :: String.t()
11+
@type failover_bucket :: [bucket: bucket, region: region]
12+
913
@type t :: %__MODULE__{
10-
bucket: String.t(),
14+
bucket: bucket,
1115
key: String.t(),
12-
region: String.t(),
13-
failover_buckets: [[bucket: String.t(), region: String.t()]] | nil
16+
region: region,
17+
failover_buckets: [failover_bucket] | nil
1418
}
1519
defstruct [:bucket, :key, :region, :failover_buckets]
1620

21+
@failover_bucket_schema [
22+
bucket: [
23+
type: :string,
24+
required: true,
25+
doc: "The name of the failover S3 bucket."
26+
],
27+
region: [
28+
type: :string,
29+
required: true,
30+
doc: "The AWS region of the failover S3 bucket."
31+
]
32+
]
33+
1734
@opts_schema [
1835
bucket: [
1936
type: :string,
@@ -31,10 +48,9 @@ defmodule RemotePersistentTerm.Fetcher.S3 do
3148
doc: "The AWS region of the s3 bucket."
3249
],
3350
failover_buckets: [
34-
type: {:list, :keyword_list},
51+
type: {:list, {:keyword_list, @failover_bucket_schema}},
3552
required: false,
36-
doc:
37-
"A list of keyword lists containing [bucket: bucket_name, region: region] to use as failover if the primary bucket fails. \n
53+
doc: "A list of failover_buckets to use as failover if the primary bucket fails. \n
3854
The directory structure in failover buckets must match the primary bucket."
3955
]
4056
]

0 commit comments

Comments
 (0)