Spotter-VM/lxc-apps/decidim/install/decidim_conf/initializers/decidim.rb

236 lines
7.9 KiB
Ruby
Raw Normal View History

2019-11-15 18:00:26 +01:00
# frozen_string_literal: true
require "twilio-ruby"
2019-11-15 18:00:26 +01:00
Decidim.configure do |config|
# The name of the application
config.application_name = "Decidim"
# The email that will be used as sender in all emails from Decidim
config.mailer_sender = "admin@example.com"
# Sets the list of available locales for the whole application.
#
# When an organization is created through the System area, system admins will
# be able to choose the available languages for that organization. That list
# of languages will be equal or a subset of the list in this file.
config.available_locales = [:cs, :sk, :en, :de, :fr, :es]
# Restrict access to the system part with an authorized ip list.
# You can use a single ip like ("1.2.3.4"), or an ip subnet like ("1.2.3.4/24")
# You may specify multiple ip in an array ["1.2.3.4", "1.2.3.4/24"]
# config.system_accesslist_ips = ["127.0.0.1"]
# Sets the default locale for new organizations. When creating a new
# organization from the System area, system admins will be able to overwrite
# this value for that specific organization.
config.default_locale = :cs
# Defines a list of custom content processors. They are used to parse and
# render specific tags inside some user-provided content. Check the docs for
# more info.
# config.content_processors = []
# Whether SSL should be enabled or not.
# config.force_ssl = true
# Geocoder configuration
if !ENV["HERE_API_KEY"].to_s.empty?
config.geocoder = {
static_map_url: "https://image.maps.ls.hereapi.com/mia/1.6/mapview",
here_api_key: ENV["HERE_API_KEY"]
}
end
# Custom resource reference generator method. Check the docs for more info.
# config.reference_generator = lambda do |resource, component|
# # Implement your custom method to generate resources references
# "1234-#{resource.id}"
# end
# Currency unit
2021-02-08 06:46:55 +01:00
config.currency_unit = ""
# Defines the quality of image uploads after processing. Image uploads are
# processed by Decidim, this value helps reduce the size of the files.
# config.image_uploader_quality = 80
# The maximum file size of an attachment
# config.maximum_attachment_size = 10.megabytes
# The maximum file size for a user avatar
# config.maximum_avatar_size = 10.megabytes
# The number of reports which a resource can receive before hiding it
# config.max_reports_before_hiding = 3
# Custom HTML Header snippets
#
# The most common use is to integrate third-party services that require some
# extra JavaScript or CSS. Also, you can use it to add extra meta tags to the
# HTML. Note that this will only be rendered in public pages, not in the admin
# section.
#
# Before enabling this you should ensure that any tracking that might be done
# is in accordance with the rules and regulations that apply to your
# environment and usage scenarios. This component also comes with the risk
# that an organization's administrator injects malicious scripts to spy on or
# take over user accounts.
#
config.enable_html_header_snippets = false
# Allow organizations admins to track newsletter links.
# config.track_newsletter_links = true
# Amount of time that the data portability files will be available in the server.
# config.data_portability_expiry_time = 7.days
# Max requests in a time period to prevent DoS attacks. Only applied on production.
# config.throttling_max_requests = 100
# Time window in which the throttling is applied.
# config.throttling_period = 1.minute
# Time window were users can access the website even if their email is not confirmed.
# config.unconfirmed_access_for = 2.days
# Etherpad configuration. Check the docs for more info.
# config.etherpad = {
# server: <your url>,
# api_key: <your key>,
# api_version: <your version>
# }
# A base path for the uploads. If set, make sure it ends in a slash.
# Uploads will be set to `<base_path>/uploads/`. This can be useful if you
# want to use the same uploads place for both staging and production
# environments, but in different folders.
#
# If not set, it will be ignored.
# config.base_uploads_path = nil
# SMS gateway configuration
#
# If you want to verify your users by sending a verification code via
# SMS you need to provide a SMS gateway service class.
#
# An example class would be something like:
#
# class MySMSGatewayService
# attr_reader :mobile_phone_number, :code
#
# def initialize(mobile_phone_number, code)
# @mobile_phone_number = mobile_phone_number
# @code = code
# end
#
# def deliver_code
# # Actual code to deliver the code
# true
# end
# end
#
class TwilioSMSGatewayService
attr_reader :mobile_phone_number, :code
def initialize(mobile_phone_number, code)
@mobile_phone_number = mobile_phone_number
@code = code
end
def deliver_code
Rails.logger.debug("Twilio SMS gateway service, verification code is: #{code}, should have been delivered to #{mobile_phone_number}")
client.messages.create(
from: ENV["TWILIO_SENDER_NUMBER"],
to: mobile_phone_number,
body: code
)
end
def client
::Twilio::REST::Client.new ENV["TWILIO_ACCOUNT_SID"], ENV["TWILIO_AUTH_TOKEN"]
end
end
if !ENV["TWILIO_ACCOUNT_SID"].to_s.empty?
config.sms_gateway_service = "TwilioSMSGatewayService"
end
# Timestamp service configuration
#
# Provide a class to generate a timestamp for a document. The instances of
# this class are initialized with a hash containing the :document key with
# the document to be timestamped as value. The istances respond to a
# timestamp public method with the timestamp
#
# An example class would be something like:
#
# class MyTimestampService
# attr_accessor :document
#
# def initialize(args = {})
# @document = args.fetch(:document)
# end
#
# def timestamp
# # Code to generate timestamp
# "My timestamp"
# end
# end
#
# config.timestamp_service = "MyTimestampService"
# PDF signature service configuration
#
# Provide a class to process a pdf and return the document including a
# digital signature. The instances of this class are initialized with a hash
# containing the :pdf key with the pdf file content as value. The instances
# respond to a signed_pdf method containing the pdf with the signature
#
# An example class would be something like:
#
# class MyPDFSignatureService
# attr_accessor :pdf
#
# def initialize(args = {})
# @pdf = args.fetch(:pdf)
# end
#
# def signed_pdf
# # Code to return the pdf signed
# end
# end
#
# config.pdf_signature_service = "MyPDFSignatureService"
# Etherpad configuration
#
# Only needed if you want to have Etherpad integration with Decidim. See
# Decidim docs at docs/services/etherpad.md in order to set it up.
#
# config.etherpad = {
# server: Rails.application.secrets.etherpad[:server],
# api_key: Rails.application.secrets.etherpad[:api_key],
# api_version: Rails.application.secrets.etherpad[:api_version]
# }
# Sets Decidim::Exporters::CSV's default column separator
# config.default_csv_col_sep = ";"
# The list of roles a user can have, not considering the space-specific roles.
# config.user_roles = %w(admin user_manager)
# The list of visibility options for amendments. An Array of Strings that
# serve both as locale keys and values to construct the input collection in
# Decidim::Amendment::VisibilityStepSetting::options.
#
# This collection is used in Decidim::Admin::SettingsHelper to generate a
# radio buttons collection input field form for a Decidim::Component
# step setting :amendments_visibility.
# config.amendments_visibility_options = %w(all participants)
end
Rails.application.config.i18n.available_locales = Decidim.available_locales
Rails.application.config.i18n.default_locale = Decidim.default_locale