Make Algolia a requirement (#636)

* Make algolia a requirement

* Remove algolia defaults

* Fix Envfile issue
This commit is contained in:
Mac Siri 2018-08-01 11:27:04 -04:00 committed by Ben Halpern
parent e9f2aa3250
commit c05ae7583e
5 changed files with 15 additions and 7 deletions

View file

@ -47,10 +47,11 @@ variable :TWITTER_SECRET, :String, default: "Optional"
variable :AIRBRAKE_API_KEY, :String, default: "Optional"
variable :AIRBRAKE_PROJECT_ID, :integer, default: 00000
# Algolia for search
variable :ALGOLIASEARCH_API_KEY, :String, default: "Optional"
variable :ALGOLIASEARCH_APPLICATION_ID, :String, default: "Optional"
variable :ALGOLIASEARCH_SEARCH_ONLY_KEY, :String, default: "Optional"
# Algolia for search (not optional)
only_in_test = proc { ENV['RACK_ENV'] == "test" ? "test-test" : nil}
variable :ALGOLIASEARCH_API_KEY, :String, default: only_in_test
variable :ALGOLIASEARCH_APPLICATION_ID, :String, default: only_in_test
variable :ALGOLIASEARCH_SEARCH_ONLY_KEY, :String, default: only_in_test
# AWS for images storages
variable :AWS_ID, :String, default: "Optional"

View file

@ -71,7 +71,7 @@ We are all humans trying to work together to improve things for the community. A
2. `bundle install`
3. `bin/yarn`
4. Set up your environment variables/secrets
* Take a look at `Envfile`. This file lists all the `ENV` variables we use and provides a fake default for any missing keys. You'll need to get your own free API keys for a few services in order to get your development environment running. [**Follow this wiki to get them.**](https://github.com/thepracticaldev/dev.to_core/wiki/Getting-API-Keys-for-Basic-Development)
* Take a look at `Envfile`. This file lists all the `ENV` variables we use and provides a fake default for any missing keys. You'll need to get your own free API keys for a few services in order to get your development environment running. Check this [wiki](https://github.com/thepracticaldev/dev.to_core/wiki/Getting-API-Keys-for-Basic-Development) on how to get them. For minimum requirement, you should obtain valid [Algolia](https://github.com/thepracticaldev/dev.to_core/wiki/Getting-API-Keys-for-Basic-Development#algolia-choose-oauth-or-email-sign-up) credentials.
* For any key that you wish to enter/replace:
1. Create `config/application.yml` by copying from the provided template (`cp config/sample_application.yml config/application.yml`). This is a personal file that is ignored in git.
2. Obtain the development variable and apply the key you wish to enter/replace. ie:

View file

@ -9,7 +9,6 @@ require 'sprockets/es6'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
ENVied.require(*ENV['ENVIED_GROUPS'] || Rails.groups)
module PracticalDeveloper
class Application < Rails::Application

View file

@ -1,3 +1,5 @@
ENVied.require(*ENV['ENVIED_GROUPS'] || Rails.groups)
class ApplicationConfig
def self.[](key)
ENVied.send(key)

View file

@ -23,7 +23,7 @@ p "2/8 Creating Users"
roles = %i(level_1_member level_2_member level_3_member level_4_member
workshop_pass)
User.clear_index!
40.times do |i|
user = User.create!(
name: name = Faker::Name.unique.name,
@ -46,6 +46,7 @@ roles = %i(level_1_member level_2_member level_3_member level_4_member
token: i.to_s,
secret: i.to_s,
user: user,
auth_data_dump: { "extra" => { "raw_info" => { "lang" => "en" } } },
)
end
@ -69,6 +70,7 @@ end
p "4/8 Creating Articles"
Article.clear_index!
80.times do |i|
tags = []
tags << "discuss" if (i % 3).zero?
@ -98,6 +100,8 @@ end
##############################################################################
p "5/8 Creating Comments"
Comment.clear_index!
120.times do
attributes = {
body_markdown: Faker::Hipster.paragraph(1),
@ -138,6 +142,7 @@ Broadcast.create!(
p "8/8 Creating chat_channel"
ChatChannel.clear_index!
ChatChannel.without_auto_index do
["Workshop", "Meta", "General"].each do |chan|
ChatChannel.create!(
@ -147,5 +152,6 @@ ChatChannel.without_auto_index do
)
end
end
ChatChannel.reindex!
##############################################################################