Giter VIP home page Giter VIP logo

algo_raise's Introduction

there was an attempt

๐Ÿ™Š that's me in at the end (not really ๐Ÿ˜‰).

algo_raise's People

Contributors

maxbeizer avatar

Watchers

 avatar  avatar

algo_raise's Issues

Algolia not 12factor, raises when not configured

Why does algoliasearch raise when not configured? How can I disengage it with an ENV VAR?

This is a very straight forward Rails app, with single scaffolded Post model. When working on parts of apps that don't involve search, I want to avoid calling Algolia to reindex. The simplest way to do that, IMO, is to require that the API key be set in an env var in the initializer, in keeping with 12factor thinking.

Understandably, Algolia throws since it's expecting the app to be configured. I would think that raise_on_failure: false would allow me to simply swallow the Algolia::AlgoliaError (API not initialized) exception, but that is not the case in destroy calls-- it causes the transaction to rollback.

So the question is: how can I completely disengage Algoliasearch with an ENV VAR?

Behavior this app is showing:

$rake test
Run options: --seed 25476

# Running:

..E

Error:
PostsControllerTest#test_should_destroy_post:
Algolia::AlgoliaError: API not initialized
    app/controllers/posts_controller.rb:57:in `destroy'
    test/controllers/posts_controller_test.rb:43:in `block (2 levels) in <class:PostsControllerTest>'
    test/controllers/posts_controller_test.rb:42:in `block in <class:PostsControllerTest>'


bin/rails test test/controllers/posts_controller_test.rb:41

.E

Error:
PostsControllerTest#test_should_create_post:
Algolia::AlgoliaError: API not initialized
    app/controllers/posts_controller.rb:30:in `block in create'
    app/controllers/posts_controller.rb:29:in `create'
    test/controllers/posts_controller_test.rb:20:in `block (2 levels) in <class:PostsControllerTest>'
    test/controllers/posts_controller_test.rb:19:in `block in <class:PostsControllerTest>'

Versions:

  • algoliasearch (1.12.7)
  • algoliasearch-rails (1.19.1)
  • rails (5.1.1) but this is also happening on my 4.2.x app

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.