Skip to content

Commit

Permalink
Add (CI) to user-agent
Browse files Browse the repository at this point in the history
  • Loading branch information
ericmj committed May 15, 2023
1 parent fe25ebc commit 5eb05bd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/hex/http.ex
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,8 @@ defmodule Hex.HTTP do
end

defp user_agent do
"Hex/#{Hex.version()} (Elixir/#{System.version()}) (OTP/#{Hex.Utils.otp_version()})"
ci = if Hex.State.fetch!(:ci), do: " (CI)", else: ""
"Hex/#{Hex.version()} (Elixir/#{System.version()}) (OTP/#{Hex.Utils.otp_version()})#{ci}"
end

def handle_hex_message(nil) do
Expand Down
5 changes: 5 additions & 0 deletions lib/hex/state.ex
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ defmodule Hex.State do
config: [:debug_solver],
default: false,
fun: {__MODULE__, :to_boolean}
},
ci: %{
env: ["CI"],
default: false,
fun: {__MODULE__, :to_boolean}
}
}

Expand Down

0 comments on commit 5eb05bd

Please sign in to comment.