LoginSignup
1
0

More than 5 years have passed since last update.

houndを自前で運用するときに課金を促されないようにする方法

Posted at

アカツキではコード品質を高めるためにhoundciを運用しています。(独自に改良も加えています。その時の記事はこちらです)3年前の古いバージョンから新しいバージョンへと切り替えようと、githubにあるリポジトリをそのままデプロイしてみたのですが、

スクリーンショット 2017-04-01 0.37.44.png

自前のサーバーで運用しているのに課金を促されるようになりましたorz課金処理を通らないとリポジトリが登録できないようになっていますので、この処理を外すことにします。

課金されているかどうかのチェックはsubscriptions_controller.rb

  def create
    if Tier.new(current_user).full? # リポジトリがTierの上限に達したら課金ページへ飛ぶ
      render json: {}, status: :payment_required
    elsif activator.activate && create_subscription # リポジトリをactivateしたらsubscriptionを追加する
      render json: repo, status: :created
    else
      activator.deactivate

      head 502
    end
  end

この辺でやってます。これを

  def create
    if activator.activate
      render json: repo, status: :created
    else
      activator.deactivate

      head 502
    end
  end

こう書き換えますと課金処理をスキップしてリポジトリの登録が行なえます。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0