Skip to content
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

Allow configuration of a self-hosted Plausible instance #10

Merged
merged 6 commits into from
Feb 2, 2024

Conversation

luizkowalski
Copy link
Contributor

hey 👋🏻

I've been playing around with self-hosting my Plausible instance and notice that the gem defaults to plausible.io

I quickly put together an option to customize it but defaults to plausible.io

@luctus
Copy link
Contributor

luctus commented Feb 2, 2024

@luizkowalski hey!

Thanks a lot for your contribution! I will add some tests and publish it as soon as possible.

In a RubyonRails app, you should put this code in an initiliazer, right?

PlausibleApi.configure do |config|
  config.base_url = "https://your-plausible-instance.com/"
end

attr_accessor :base_url

def base_url
@base_url || "https://plausible.io"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I often do is setup defaults in initialize and then do an attr_accessor as you have for overriding. Then you aren't making the same string over and over. Minor so every one feel free to ignore me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated. let me know if that's what you meant.

@jnunemaker
Copy link
Contributor

In a RubyonRails app, you should put this code in an initializer, right?

@luctus as a rails user, yep! That's what we recommend for flipper.

@luctus luctus merged commit e6084e2 into dailytics:main Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants