Skip to content

Commit

Permalink
fix publish (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
ignaciogoldchluk-yolo authored Aug 14, 2024
1 parent 8075edb commit 3b2e3f0
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 17 deletions.
28 changes: 22 additions & 6 deletions .github/workflows/hex.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,26 @@ on:
jobs:
publish:
runs-on: ubuntu-latest
name: Publish
strategy:
matrix:
otp: ['26']
elixir: ['1.15.7']
env:
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
steps:
- name: Check out
uses: actions/checkout@v4
- name: Publish to Hex.pm
uses: wesleimp/action-publish-hex@v1
env:
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
- uses: actions/checkout@v4
- uses: erlef/setup-beam@v1
with:
otp-version: ${{matrix.otp}}
elixir-version: ${{matrix.elixir}}
- name: Restore dependencies cache
uses: actions/cache@v4
with:
path: deps
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-release-deps-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-release-deps-${{ hashFiles('**/mix.lock') }}
${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-release-deps
- run: mix deps.get
- run: mix hex.publish --yes
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## [3.1.0] (2024-08-14)

### Enhancements
- Add `:enabled` config value
- `:adapter` config value is now optional and defaults to `Coney.RabbitConnection`

## [3.0.2] (2024-08-12)

### Bug fixes
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ Default config:
```elixir
# config/config.exs
config :coney,
adapter: Coney.RabbitConnection,
auto_start: true,
settings: %{
url: "amqp://guest:guest@localhost", # or ["amqp://guest:guest@localhost", "amqp://guest:guest@other_host"]
Expand Down Expand Up @@ -77,7 +76,6 @@ Also, you can create a confuguration module (if you want to retreive settings fr
```elixir
# config/config.exs
config :coney,
adapter: Coney.RabbitConnection,
auto_start: true,
settings: RabbitConfig,
topology: RabbitConfig
Expand Down Expand Up @@ -133,6 +131,12 @@ defmodule YourApplication do
end
```

If you want to disable Coney altogether (useful for testing config) set `enabled: false`
```elixir
# config/config.exs
config :coney, enabled: false, settings: %{}, topology: %{}
```

## Configure consumers

```elixir
Expand Down
1 change: 0 additions & 1 deletion config/config.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Config

config :coney,
adapter: Coney.RabbitConnection,
pool_size: 1,
auto_start: true,
settings: %{
Expand Down
1 change: 0 additions & 1 deletion config/test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ config :coney,
}
}
},
adapter: Coney.RabbitConnection,
pool_size: 1,
auto_start: true,
settings: %{
Expand Down
18 changes: 13 additions & 5 deletions lib/coney/application_supervisor.ex
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,25 @@ defmodule Coney.ApplicationSupervisor do
def init([consumers]) do
settings = settings()

children = [
{ConnectionServer, [settings]},
{ConsumerSupervisor, [consumers]}
]
{enabled?, settings} = Keyword.pop!(settings, :enabled)

children =
if enabled? do
[
{ConnectionServer, [settings]},
{ConsumerSupervisor, [consumers]}
]
else
[]
end

Supervisor.init(children, strategy: :one_for_one)
end

def settings do
[
adapter: Application.get_env(:coney, :adapter),
adapter: Application.get_env(:coney, :adapter, Coney.RabbitConnection),
enabled: Application.get_env(:coney, :enabled, true),
settings: get_config(:settings, :settings),
topology: get_config(:topology, :topology, %{exchanges: [], queues: []})
]
Expand Down
4 changes: 2 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ defmodule Coney.Mixfile do
def project do
[
app: :coney,
version: "3.0.2",
elixir: ">= 1.10.0",
version: "3.1.0",
elixir: ">= 1.12.0",
build_embedded: Mix.env() == :prod,
start_permanent: Mix.env() == :prod,
description: description(),
Expand Down

0 comments on commit 3b2e3f0

Please sign in to comment.