@@ -50,21 +50,16 @@ defmodule ElixirMake.Downloader.Httpc do
50
50
51
51
defp cacerts_options do
52
52
cond do
53
+ path = System . get_env ( "HEX_CACERTS_PATH" ) ->
54
+ [ cacertfile: path ]
55
+
53
56
path = System . get_env ( "ELIXIR_MAKE_CACERT" ) ->
57
+ IO . warn ( "Setting ELIXIR_MAKE_CACERT is deprecated, please set HEX_CACERTS_PATH instead" )
54
58
[ cacertfile: path ]
55
59
56
60
certs = otp_cacerts ( ) ->
57
61
[ cacerts: certs ]
58
62
59
- Application . spec ( :castore , :vsn ) ->
60
- [ cacertfile: Application . app_dir ( :castore , "priv/cacerts.pem" ) ]
61
-
62
- Application . spec ( :certifi , :vsn ) ->
63
- [ cacertfile: Application . app_dir ( :certifi , "priv/cacerts.pem" ) ]
64
-
65
- path = cacerts_from_os ( ) ->
66
- [ cacertfile: path ]
67
-
68
63
true ->
69
64
warn_no_cacerts ( )
70
65
[ ]
@@ -77,65 +72,27 @@ defmodule ElixirMake.Downloader.Httpc do
77
72
try do
78
73
:public_key . cacerts_get ( )
79
74
rescue
80
- _ ->
81
- nil
75
+ _ -> nil
82
76
end
83
77
end
84
78
end
85
79
86
- # https_opts and related code are taken from
87
- # https://github.com/elixir-cldr/cldr_utils/blob/v2.19.1/lib/cldr/http/http.ex
88
- @ certificate_locations [
89
- # Debian/Ubuntu/Gentoo etc.
90
- "/etc/ssl/certs/ca-certificates.crt" ,
91
-
92
- # Fedora/RHEL 6
93
- "/etc/pki/tls/certs/ca-bundle.crt" ,
94
-
95
- # OpenSUSE
96
- "/etc/ssl/ca-bundle.pem" ,
97
-
98
- # OpenELEC
99
- "/etc/pki/tls/cacert.pem" ,
100
-
101
- # CentOS/RHEL 7
102
- "/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem" ,
103
-
104
- # Open SSL on MacOS
105
- "/usr/local/etc/openssl/cert.pem" ,
106
-
107
- # MacOS & Alpine Linux
108
- "/etc/ssl/cert.pem"
109
- ]
110
-
111
- defp cacerts_from_os do
112
- Enum . find ( @ certificate_locations , & File . exists? / 1 )
113
- end
114
-
115
80
defp warn_no_cacerts do
116
81
Mix . shell ( ) . error ( """
117
82
No certificate trust store was found.
118
83
119
- Tried looking for: #{ inspect ( @ certificate_locations ) }
120
-
121
84
A certificate trust store is required in
122
85
order to download locales for your configuration.
123
86
Since elixir_make could not detect a system
124
87
installed certificate trust store one of the
125
88
following actions may be taken:
126
89
127
- 1. Install the hex package `castore`. It will
128
- be automatically detected after recompilation.
129
-
130
- 2. Install the hex package `certifi`. It will
131
- be automatically detected after recompilation.
132
-
133
- 3. Specify the location of a certificate trust store
90
+ 1. Specify the location of a certificate trust store
134
91
by configuring it in environment variable:
135
92
136
- export ELIXIR_MAKE_CACERT ="/path/to/cacerts.pem"
93
+ export HEX_CACERTS_PATH ="/path/to/cacerts.pem"
137
94
138
- 4 . Use OTP 25+ on an OS that has built-in certificate
95
+ 2 . Use OTP 25+ on an OS that has built-in certificate
139
96
trust store.
140
97
""" )
141
98
end
0 commit comments