Updated unified sample.env and setup default values to some variables

This commit is contained in:
jfederico 2017-08-14 20:26:43 +00:00
parent 582ab30eb0
commit ea5c78db47
6 changed files with 140 additions and 171 deletions

View File

@ -205,7 +205,7 @@ class BbbController < ApplicationController
if Rails.configuration.enable_youtube_uploading == false then if Rails.configuration.enable_youtube_uploading == false then
uploadable = 'uploading_disabled' uploadable = 'uploading_disabled'
elsif current_user.provider != 'google' elsif current_user.provider != 'google'
uploadable = 'invalid_provider' uploadable = 'invalid_provider'
else else
uploadable = (Faraday.head(get_webcams_url(params[:rec_id])).status == 200 && current_user.provider == 'google').to_s uploadable = (Faraday.head(get_webcams_url(params[:rec_id])).status == 200 && current_user.provider == 'google').to_s
end end
@ -213,7 +213,7 @@ class BbbController < ApplicationController
end end
def get_webcams_url(recording_id) def get_webcams_url(recording_id)
uri = URI.parse(ENV['BIGBLUEBUTTON_ENDPOINT']) uri = URI.parse(Rails.configuration.bigbluebutton_endpoint)
uri.scheme + '://' + uri.host + '/presentation/' + recording_id + '/video/webcams.webm' uri.scheme + '://' + uri.host + '/presentation/' + recording_id + '/video/webcams.webm'
end end
@ -291,10 +291,10 @@ class BbbController < ApplicationController
actioncable_event('create', params[:id], params[:room_id]) actioncable_event('create', params[:id], params[:room_id])
elsif eventName == "meeting_destroyed_event" elsif eventName == "meeting_destroyed_event"
actioncable_event('destroy', params[:id], params[:room_id]) actioncable_event('destroy', params[:id], params[:room_id])
# Since the meeting is destroyed we have no way get the callback url to remove the meeting, so we must build it. # Since the meeting is destroyed we have no way get the callback url to remove the meeting, so we must build it.
remove_url = build_callback_url(params[:id], params[:room_id]) remove_url = build_callback_url(params[:id], params[:room_id])
# Remove webhook for the meeting. # Remove webhook for the meeting.
webhook_remove(remove_url) webhook_remove(remove_url)
elsif eventName == "user_joined_message" elsif eventName == "user_joined_message"
@ -307,7 +307,7 @@ class BbbController < ApplicationController
render head(:ok) && return render head(:ok) && return
end end
def build_callback_url(id, room_id) def build_callback_url(id, room_id)
"#{request.base_url}#{relative_root}/rooms/#{room_id}/#{URI.encode(id)}/callback" "#{request.base_url}#{relative_root}/rooms/#{room_id}/#{URI.encode(id)}/callback"
end end

View File

@ -20,11 +20,11 @@ module BbbApi
META_HOOK_URL = "gl-webhooks-callback-url" META_HOOK_URL = "gl-webhooks-callback-url"
def bbb_endpoint def bbb_endpoint
Rails.configuration.bigbluebutton_endpoint || '' Rails.configuration.bigbluebutton_endpoint
end end
def bbb_secret def bbb_secret
Rails.configuration.bigbluebutton_secret || '' Rails.configuration.bigbluebutton_secret
end end
def bbb def bbb

View File

@ -37,13 +37,13 @@ module Greenlight
config.i18n.fallbacks = {'en' => 'en-US'} config.i18n.fallbacks = {'en' => 'en-US'}
# BigBlueButton # BigBlueButton
config.bigbluebutton_endpoint = ENV['BIGBLUEBUTTON_ENDPOINT'] config.bigbluebutton_endpoint = ENV['BIGBLUEBUTTON_ENDPOINT'] || 'http://test-install.blindsidenetworks.com/bigbluebutton/'
config.bigbluebutton_secret = ENV['BIGBLUEBUTTON_SECRET'] config.bigbluebutton_secret = ENV['BIGBLUEBUTTON_SECRET'] || '8cd8ef52e8e101574e400365b55e11a6'
config.use_webhooks = ENV['GREENLIGHT_USE_WEBHOOKS'] == "true" config.use_webhooks = ENV['GREENLIGHT_USE_WEBHOOKS'] && ENV['GREENLIGHT_USE_WEBHOOKS'] == "true"
config.mail_notifications = ENV['GREENLIGHT_MAIL_NOTIFICATIONS'] == "true" config.mail_notifications = ENV['GREENLIGHT_MAIL_NOTIFICATIONS'] && ENV['GREENLIGHT_MAIL_NOTIFICATIONS'] == "true"
config.disable_guest_access = ENV['DISABLE_GUEST_ACCESS'] == "true" config.disable_guest_access = ENV['DISABLE_GUEST_ACCESS'] && ENV['DISABLE_GUEST_ACCESS'] == "true"
config.enable_youtube_uploading = ENV['ENABLE_YOUTUBE_UPLOADING'] == "true" config.enable_youtube_uploading = ENV['ENABLE_YOUTUBE_UPLOADING'] && ENV['ENABLE_YOUTUBE_UPLOADING'] == "true"
# SMTP and action mailer # SMTP and action mailer
if config.mail_notifications if config.mail_notifications
@ -57,7 +57,7 @@ module Greenlight
config.smtp_starttls_auto = ENV['SMTP_STARTTLS_AUTO'].nil? ? true : ENV['SMTP_STARTTLS_AUTO'] config.smtp_starttls_auto = ENV['SMTP_STARTTLS_AUTO'].nil? ? true : ENV['SMTP_STARTTLS_AUTO']
config.smtp_tls = ENV['SMTP_TLS'].nil? ? false : ENV['SMTP_TLS'] config.smtp_tls = ENV['SMTP_TLS'].nil? ? false : ENV['SMTP_TLS']
config.action_mailer.default_url_options = { host: ENV['GREENLIGHT_DOMAIN'] } config.action_mailer.default_url_options = { host: ENV['GREENLIGHT_DOMAIN'] || 'localhost' }
config.action_mailer.delivery_method = :smtp config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true config.action_mailer.raise_delivery_errors = true

View File

@ -23,14 +23,15 @@ rescue URI::InvalidURIError
false false
end end
if !ENV['SLACK_WEBHOOK'].nil? && !ENV['SLACK_WEBHOOK'].empty? && uri?(ENV['SLACK_WEBHOOK']) then if !ENV['SLACK_WEBHOOK'] || !ENV['SLACK_CHANNEL'] || !uri?(ENV['SLACK_WEBHOOK']) then
# Initialize the slack notifier.
Rails.application.config.slack_notifier = Slack::Notifier.new ENV['SLACK_WEBHOOK'] do
defaults channel: ENV['SLACK_CHANNEL'],
username: "BigBlueButton",
icon_url: 'https://avatars3.githubusercontent.com/u/230228?v=3&s=200'
end
else
# Initialize it to nil (slack not configured) # Initialize it to nil (slack not configured)
Rails.application.config.slack_notifier = nil Rails.application.config.slack_notifier = nil
return
end
# Initialize the slack notifier.
Rails.application.config.slack_notifier = Slack::Notifier.new ENV['SLACK_WEBHOOK'] do
defaults channel: ENV['SLACK_CHANNEL'],
username: "BigBlueButton",
icon_url: 'https://avatars3.githubusercontent.com/u/230228?v=3&s=200'
end end

124
env
View File

@ -1,124 +0,0 @@
# Step 1 - Create a secret key for rails
#
# You can generate a secure one through the Greenlight docker image
# with with the command
#
# docker run --rm bigbluebutton/greenlight rake secret
#
SECRET_KEY_BASE=
# Step 2 - Enter credentials for your BigBlueButton Server
#
# The endpoint and secret from your bigbluebutton server. To get these values, run
# the following command on your BigBlueButton server
#
# bbb-conf --secret
#
# and uncomment the following two variables
#BIGBLUEBUTTON_ENDPOINT=
#BIGBLUEBUTTON_SECRET=
# Twitter Login Provider (optional)
#
# You will need to register the app at https://apps.twitter.com/
# For the callback URL use 'http://<your hostname:port>/auth/twitter/callback'
# Once registered copy the ID and Secret here
#
TWITTER_ID=
TWITTER_SECRET=
# Google Login Provider (optional)
#
# You will need to register for at https://console.developers.google.com/apis/credentials
# Select Oauth client ID -> web application
# For the callback URL use 'http://<your hostname:port>/auth/google/callback'
# Once registered copy the ID and Secret here
#
# The GOOGLE_OAUTH2_HD variable is used to limit sign-in to a particular Google Apps hosted domain. This
# can be a string such as, 'domain.com'. If left blank, GreenLight will allow sign-in from all Google Apps hosted
# domains.
#
GOOGLE_OAUTH2_ID=
GOOGLE_OAUTH2_SECRET=
GOOGLE_OAUTH2_HD=
# LDAP Login Provider (optional)
#
# You can enable LDAP authentication by providing values for the variables below.
# For information about setting up LDAP, see:
# http://docs.bigbluebutton.org/install/green-light.html#ldap-oauth
#
LDAP_SERVER=
LDAP_PORT=
LDAP_METHOD=
LDAP_UID=
LDAP_BASE=
LDAP_BIND_DN=
LDAP_PASSWORD=
# If "true", GreenLight will register a webhook callback for each meeting
# created. This callback is called for all events that happen in the meeting,
# including the processing of its recording. These events are used to update
# the web page dynamically as things happen in the server.
# If not "true", the application will add a metadata to the meetings with this same
# callback URL. Scripts can then be added to BigBlueButton to call this callback
# URL and send specific events to GreenLight (e.g. a post publish script to warn
# the application when recordings are done).
GREENLIGHT_USE_WEBHOOKS=false
# Enable uploading to Youtube (optional)
#
# When this is enabled, users will be able to directly upload their recordings
# to Youtube. If you plan to enable this, you should follow the steps outlined
# in our docs for setting up the Youtube data API.
#
# http://docs.bigbluebutton.org/install/green-light.html#8-enabling-uploading-to-youtube-optional
#
ENABLE_YOUTUBE_UPLOADING=false
# Slack Integration (optional)
#
# You will need to register an incoming-webhook for your slack channel
# in order for GreenLight to post to it. You can do this by going
# to https://slack.com/apps/A0F7XDUAZ-incoming-webhooks, selecting your
# team and then selecting "Add Incoming WebHooks integration" on the
# desired channel. You will then need to paste the webhook below.
#
SLACK_WEBHOOK=
SLACK_CHANNEL=
# Landing Background (optional)
#
# Supply a URL to an image to change the landing background. If no
# URL is provided GreenLight will use a default image. If you
# supply a path that does not lead to an image, no landing image
# will appear.
#
LANDING_BACKGROUND=
# SMTP Mailer
#
GREENLIGHT_MAIL_NOTIFICATIONS=true
GREENLIGHT_DOMAIN=localhost-lxc.org
SMTP_FROM=youremail@gmail.com
SMTP_SERVER=smtp.gmail.com
SMTP_PORT=587
SMTP_DOMAIN=gmail.com
SMTP_USERNAME=youremail@gmail.com
SMTP_PASSWORD=yourpassword
# SMTP_TLS=false
# SMTP_AUTH=login
# SMTP_STARTTLS_AUTO=true
# Prefix for the application's root URL
# Useful for deploying the application to a subdirectory
#
# default is '/b' (recommended)
#
#RELATIVE_URL_ROOT=/b
# Uncomment and set to 'true' to only allow users to create meetings when authenticated.
# Unauthenticated users are still able to join meetings through invites.
#DISABLE_GUEST_ACCESS=false
# Comment this out to send logs to STDOUT in production instead of log/production.log .
DISABLE_RAILS_LOG_TO_STDOUT=true

View File

@ -1,11 +1,71 @@
# This is a sample of the environment variables you will need for development # This is a sample of the environment variables you will need
# To use, copy this file to .env `cp sample.env .env` # To use, copy this file to .env `cp sample.env .env`
RAILS_ENV=development
# BigBlueButton # For production only
BIGBLUEBUTTON_ENDPOINT=
BIGBLUEBUTTON_SECRET= # RAILS_ENV=production
# Create a secret key for rails
#
# You can generate a secure one through the Greenlight docker image
# with with the command
#
# docker run --rm bigbluebutton/greenlight rake secret
#
# SECRET_KEY_BASE=
# For either developent or production
# Enter credentials for your BigBlueButton Server
#
# The endpoint and secret from your bigbluebutton server. To get these values, run
# the following command on your BigBlueButton server
#
# bbb-conf --secret
#
# and uncomment the following two variables
# BIGBLUEBUTTON_ENDPOINT=http://test-install.blindsidenetworks.com/bigbluebutton/
# BIGBLUEBUTTON_SECRET=8cd8ef52e8e101574e400365b55e11a6
# Twitter Login Provider (optional)
#
# You will need to register the app at https://apps.twitter.com/
# For the callback URL use 'http://<your hostname:port>/auth/twitter/callback'
# Once registered copy the ID and Secret here
#
# TWITTER_ID=
# TWITTER_SECRET=
# Google Login Provider (optional)
#
# You will need to register for at https://console.developers.google.com/apis/credentials
# Select Oauth client ID -> web application
# For the callback URL use 'http://<your hostname:port>/auth/google/callback'
# Once registered copy the ID and Secret here
#
# The GOOGLE_OAUTH2_HD variable is used to limit sign-in to a particular Google Apps hosted domain. This
# can be a string such as, 'domain.com'. If left blank, GreenLight will allow sign-in from all Google Apps hosted
# domains.
#
# GOOGLE_OAUTH2_ID=
# GOOGLE_OAUTH2_SECRET=
# GOOGLE_OAUTH2_HD=
# LDAP Login Provider (optional)
#
# You can enable LDAP authentication by providing values for the variables below.
# For information about setting up LDAP, see:
# http://docs.bigbluebutton.org/install/green-light.html#ldap-oauth
#
# LDAP_SERVER=
# LDAP_PORT=
# LDAP_METHOD=
# LDAP_UID=
# LDAP_BASE=
# LDAP_BIND_DN=
# LDAP_PASSWORD=
# If "true", GreenLight will register a webhook callback for each meeting # If "true", GreenLight will register a webhook callback for each meeting
# created. This callback is called for all events that happen in the meeting, # created. This callback is called for all events that happen in the meeting,
@ -15,31 +75,63 @@ BIGBLUEBUTTON_SECRET=
# callback URL. Scripts can then be added to BigBlueButton to call this callback # callback URL. Scripts can then be added to BigBlueButton to call this callback
# URL and send specific events to GreenLight (e.g. a post publish script to warn # URL and send specific events to GreenLight (e.g. a post publish script to warn
# the application when recordings are done). # the application when recordings are done).
GREENLIGHT_USE_WEBHOOKS=false # GREENLIGHT_USE_WEBHOOKS=true
# The web site domain, needed for emails mostly # Enable uploading to Youtube (optional)
GREENLIGHT_DOMAIN=localhost #
# When this is enabled, users will be able to directly upload their recordings
# to Youtube. If you plan to enable this, you should follow the steps outlined
# in our docs for setting up the Youtube data API.
#
# http://docs.bigbluebutton.org/install/green-light.html#8-enabling-uploading-to-youtube-optional
#
# ENABLE_YOUTUBE_UPLOADING=false
# Enable email notifications # Slack Integration (optional)
GREENLIGHT_MAIL_NOTIFICATIONS=true #
# You will need to register an incoming-webhook for your slack channel
# in order for GreenLight to post to it. You can do this by going
# to https://slack.com/apps/A0F7XDUAZ-incoming-webhooks, selecting your
# team and then selecting "Add Incoming WebHooks integration" on the
# desired channel. You will then need to paste the webhook below.
#
# SLACK_WEBHOOK=
# SLACK_CHANNEL=
# Email configurations # Landing Background (optional)
SMTP_FROM=email@gmail.com #
SMTP_SERVER=smtp.gmail.com # Supply a URL to an image to change the landing background. If no
SMTP_DOMAIN=gmail.com # URL is provided GreenLight will use a default image. If you
SMTP_PORT=587 # supply a path that does not lead to an image, no landing image
SMTP_USERNAME=email@gmail.com # will appear.
SMTP_PASSWORD=my-secret-password #
# LANDING_BACKGROUND=
# SMTP Mailer (optional)
#
# GREENLIGHT_MAIL_NOTIFICATIONS=true
# In the format [localhost.localdomain]
# GREENLIGHT_DOMAIN=localhost
# SMTP_FROM=youremail@gmail.com
# SMTP_SERVER=smtp.gmail.com
# SMTP_PORT=587
# SMTP_DOMAIN=gmail.com
# SMTP_USERNAME=youremail@gmail.com
# SMTP_PASSWORD=yourpassword
# SMTP_TLS=false # SMTP_TLS=false
# SMTP_AUTH=login # SMTP_AUTH=login
# SMTP_STARTTLS_AUTO=true # SMTP_STARTTLS_AUTO=true
# OmniAuth # Prefix for the application's root URL
TWITTER_ID= # Useful for deploying the application to a subdirectory
TWITTER_SECRET= #
GOOGLE_OAUTH2_ID= # default is '/b' (recommended)
GOOGLE_OAUTH2_SECRET= #
# RELATIVE_URL_ROOT=/b
# For production # Uncomment and set to 'true' to only allow users to create meetings when authenticated.
SECRET_KEY_BASE= # Unauthenticated users are still able to join meetings through invites.
HOSTNAME= # DISABLE_GUEST_ACCESS=false
# Comment this out to send logs to STDOUT in production instead of log/production.log .
DISABLE_RAILS_LOG_TO_STDOUT=true