Skip to content

chore: change guidance on starting application #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 0 additions & 56 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,62 +27,6 @@ def deps do
end
```

You'll also need to include this library under your application tree. You can do so by including `:posthog` under your `:extra_applications` key inside `mix.exs`

```elixir
# mix.exs
def application do
[
extra_applications: [
# ... your existing applications
:posthog
]
]
```

or if you already have a `YourApp.Application` application, you can also add `Posthog.Application` under your supervision tree:

```elixir
# lib/my_app/application.ex
defmodule MyApp.Application do
use Application

def start(_type, _args) do
children = [
# Your other children...
{Posthog.Application, []}
]

opts = [strategy: :one_for_one, name: MyApp.Supervisor]
Supervisor.start_link(children, opts)
end
end
```

### Application Customization

This library includes a `Posthog.Application` because we bundle `Cachex` to allow you to track inside PostHog your FF usage.

This cache is located under `:posthog_feature_flag_cache`. If you want more control over the application, you can init it yourself in your own `application.ex`

```elixir
# lib/my_app/application.ex

defmodule MyApp.Application do
use Application

def start(_type, _args) do
children = [
# Your other application children...
{Posthog.Application, []}
]

opts = [strategy: :one_for_one, name: MyApp.Supervisor]
Supervisor.start_link(children, opts)
end
end
```

## Configuration

Add your PostHog configuration to your application's config:
Expand Down