remove settings yaml config
This commit is contained in:
parent
a3d536aa05
commit
c0ddd25198
17
README.md
17
README.md
|
@ -6,30 +6,15 @@ Accept donations in Discourse! Integrates with [Stripe](https://stripe.com).
|
|||
|
||||
## Configuration
|
||||
|
||||
You can either set your environment vars in docker or save them in a yaml.
|
||||
|
||||
In your `app.yml`:
|
||||
|
||||
```
|
||||
STRIPE_SECRET_KEY: 'sk_test_key'
|
||||
STRIPE_PUBLISHABLE_KEY: 'pk_test_key'
|
||||
```
|
||||
Visit `/admin/plugins` and configure your private and public keys.
|
||||
|
||||
## TODO
|
||||
|
||||
* Remove hard coded key and use settings.
|
||||
* Add a plugin outlet for custom user fields.
|
||||
* Some tests
|
||||
* Handle fails from stripe
|
||||
* A button in the user's profile page.
|
||||
|
||||
**In your app.yml**
|
||||
|
||||
```
|
||||
STRIPE_SECRET_KEY: 'my_secret_key'
|
||||
STRIPE_PUBLISHABLE_KEY: 'my_publishable_key'
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
To run the rails specs, install the plugin and run `bundle exec rake plugin:spec[discourse-donations]` in the discourse root directory.
|
||||
|
|
|
@ -7,6 +7,8 @@ module DiscourseDonations
|
|||
skip_before_filter :verify_authenticity_token, only: [:create]
|
||||
|
||||
def create
|
||||
Stripe.api_key = SiteSetting.discourse_donations_secret_key
|
||||
|
||||
customer = Stripe::Customer.create(
|
||||
:email => current_user.email,
|
||||
:source => params[:stripeToken]
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
|
||||
if File.exist?('config/stripe.yml')
|
||||
Rails.configuration.stripe = {
|
||||
:publishable_key => Rails.application.config_for(:stripe)['publishable_key'],
|
||||
:secret_key => Rails.application.config_for(:stripe)['secret_key']
|
||||
}
|
||||
else
|
||||
Rails.configuration.stripe = {
|
||||
:publishable_key => ENV['STRIPE_PUBLISHABLE_KEY'],
|
||||
:secret_key => ENV['STRIPE_SECRET_KEY']
|
||||
}
|
||||
end
|
||||
|
||||
Stripe.api_key = Rails.configuration.stripe[:secret_key]
|
|
@ -1,15 +1,12 @@
|
|||
# name: discourse-donations
|
||||
# about: Integrating Discourse with Stripe for donations
|
||||
# version: 1.6.5
|
||||
# version: 1.6.7
|
||||
# url: https://github.com/choiceaustralia/discourse-donations
|
||||
# authors: Rimian Perkins
|
||||
|
||||
gem 'stripe', '2.0.1'
|
||||
|
||||
load File.expand_path('../lib/discourse_donations/engine.rb', __FILE__)
|
||||
load File.expand_path('../config/stripe.rb', __FILE__)
|
||||
|
||||
enabled_site_setting :discourse_donations_enabled
|
||||
|
||||
after_initialize do
|
||||
header_script = '<script src="https://js.stripe.com/v3/"></script>'
|
||||
|
|
Loading…
Reference in New Issue