Skip to content

Commit c0adfbf

Browse files
committed
Enhance README.md with configuration instructions for Rails and non-Rails applications, utilizing Rails credentials and environment variables for API key and account ID.
1 parent dc71c98 commit c0adfbf

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

README.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,29 @@ $ gem install feedbackface-ruby
4040

4141
## Usage
4242

43-
First, configure the client with your API key:
43+
### Configuration
44+
45+
First, configure the client with your API key. In a Rails application, it's recommended to add this configuration to an initializer:
46+
47+
Create `config/initializers/feedbackface.rb`:
4448

4549
```ruby
50+
# config/initializers/feedbackface.rb
4651
FeedbackFace.configure do |config|
47-
config.api_key = "your_api_key_here"
52+
config.api_key = Rails.application.credentials.dig(:feedbackface, :api_key)
4853
# 1. Go to https://feedbackface.com/accounts
4954
# 2. Select an account
5055
# 3. Find your account ID in the url in the format acct_123 (e.g. https://feedbackface.com/accounts/acct_123)
51-
config.account_id = "acct_123"
56+
config.account_id = Rails.application.credentials.dig(:feedbackface, :account_id)
57+
end
58+
```
59+
60+
For non-Rails applications, configure directly:
61+
62+
```ruby
63+
FeedbackFace.configure do |config|
64+
config.api_key = ENV["FEEDBACKFACE_API_KEY"]
65+
config.account_id = ENV["FEEDBACKFACE_ACCOUNT_ID"]
5266
end
5367
```
5468

0 commit comments

Comments
 (0)