-
Notifications
You must be signed in to change notification settings - Fork 0
Basic Setup
RailsBase needs some basic configuration to function. The following configuration file is needed for the insane amount of customization that RailsBase offers (List of Configurable options)
# config/initializers/rails_base_config.rb
RailsBase.configure do |config|
# Rails base is filled with some sane defaults.
# This file is not necesary and can also be used with ENV variables
end
Email is a requirment for authenticaiton with RailsBase. Google Mail offers a free option to mail from any account.
Add the following to the rails base configuration:
# config/initializers/rails_base_config.rb
RailsBase.configure do |config|
# ...
config.mailer.from = '<user_name>'
config.mailer.password = '<app_password>'
# ...
end
MFA/2FA is enabled with Twilio and an account with Twilio account is required. Twilio Sign up Please note that twilio has a test credentials that do not require you to spend credits sending a text message
# config/initializers/rails_base_config.rb
RailsBase.configure do |config|
# ...
config.mfa.twilio_sid = '<twilio_sid>'
config.mfa.twilio_auth_token = '<twilio_auth_token>'
config.mfa.twilio_from_number = '<twilio from number>'
# ...
end
MFA and 2FA can is not a requirement, but it must be turned off explicitly. To turn this feature off add the following to the configuration:
# config/initializers/rails_base_config.rb
RailsBase.configure do |config|
# ...
config.mfa.enable = false
# ...
end
# config/initializers/rails_base_config.rb
RailsBase.configure do |config|
config.mailer.from = '<user_name>'
config.mailer.password = '<app_password>'
config.mfa.twilio_sid = '<twilio_sid>'
config.mfa.twilio_auth_token = '<twilio_auth_token>'
config.mfa.twilio_from_number = '<twilio from number>'
end
When a new project starts, the controllers will be initialized like the following:
# app/controllers/application_controller.rb
class ApplicationController < ActionController::Base
end
# BAD
We don't want our application controller initialized like this. We want it to looke like the following:
# app/controllers/application_controller.rb
class ApplicationController < RailsBase::ApplicationController
end
# Good!!
This will inherit from RailsBase::ApplicationController where the controllers main lgoic is shared from.
In the main application routes folder, mount the the RailsBase Engine routes.
# config/routes.rb
Rails.application.routes.draw do
mount RailsBase::Engine => '/'
#
# The rest of your applications routes
#
end
View the Dummy Application routes for how the routes should look.
RailsBase provides a User Migration, ShortLivedData Migration, Secrets Migration, and AdminAction Migration. These allow the basic functionality and must be run priort to booting a project with RailsBase for the first time.
In bash console ensure the following is run:
bin/rails db:migrate
At this point you should be able start your server and run the application. You can seed the DB with a basic User or create a user yourself by signing up!
bin/rails s