๐ that's me in at the end (not really ๐).
algo_raise's Introduction
algo_raise's People
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.