mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-11-28 09:24:24 +01:00
configure default_host & default_protocol from env
reverts478a6c40
(partially) &b2434864
This commit is contained in:
parent
1a38a8750b
commit
45013be950
@ -1032,14 +1032,14 @@ angular.module('application.router', ['ui.router'])
|
||||
resolve: {
|
||||
settingsPromise: ['Setting', function (Setting) {
|
||||
return Setting.query({
|
||||
names: `['twitter_name', 'about_title', 'about_body', 'tracking_id', 'facebook_app_id', 'base_url_host', \
|
||||
names: `['twitter_name', 'about_title', 'about_body', 'tracking_id', 'facebook_app_id', \
|
||||
'privacy_body', 'privacy_dpo', 'about_contacts', 'book_overlapping_slots', 'invoicing_module', \
|
||||
'home_blogpost', 'machine_explications_alert', 'training_explications_alert', 'slot_duration', \
|
||||
'training_information_message', 'subscription_explications_alert', 'event_explications_alert', \
|
||||
'space_explications_alert', 'booking_window_start', 'booking_window_end', 'events_in_calendar', \
|
||||
'booking_move_enable', 'booking_move_delay', 'booking_cancel_enable', 'feature_tour_display', \
|
||||
'booking_cancel_delay', 'main_color', 'secondary_color', 'spaces_module', 'twitter_analytics', \
|
||||
'fablab_name', 'name_genre', 'reminder_enable', 'plans_module', 'base_url_protocol', \
|
||||
'fablab_name', 'name_genre', 'reminder_enable', 'plans_module', \
|
||||
'reminder_delay', 'visibility_yearly', 'visibility_others', 'email_from', \
|
||||
'display_name_enable', 'machines_sort_by', 'fab_analytics', \
|
||||
'link_name', 'home_content', 'home_css', 'phone_required']` }).$promise;
|
||||
|
@ -380,34 +380,6 @@
|
||||
</text-setting>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<h3 class="m-l" translate>{{ 'app.admin.settings.general.site_url' }}</h3>
|
||||
<p class="alert alert-warning m-h-md" ng-bind-html="'app.admin.settings.general.site_url_info_html' | translate:{ NAME:('app.admin.settings.general.auto_fill' | translate) }"></p>
|
||||
<div class="col-md-4">
|
||||
<text-setting name="base_url_protocol"
|
||||
settings="allSettings"
|
||||
label="app.admin.settings.general.protocol"
|
||||
fa-icon="fa-globe"
|
||||
placeholder="https"
|
||||
required="true">
|
||||
</text-setting>
|
||||
</div>
|
||||
<div class="col-md-4 col-md-offset-1">
|
||||
<text-setting name="base_url_host"
|
||||
settings="allSettings"
|
||||
label="app.admin.settings.general.host"
|
||||
fa-icon="fa-server"
|
||||
placeholder="example.com"
|
||||
required="true">
|
||||
</text-setting>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<button class="btn btn-default m-t-lg" ng-click="detectFillUrl()">
|
||||
<i class="fa fa-search m-r-sm"></i>
|
||||
<span translate>{{ 'app.admin.settings.general.auto_fill' }}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -69,20 +69,6 @@
|
||||
placeholder="UA-000000-2">
|
||||
</text-setting>
|
||||
</div>
|
||||
<div class="col-md-4 col-md-offset-1">
|
||||
<text-setting name="base_url_host"
|
||||
settings="allSettings"
|
||||
label="app.admin.settings.general.host"
|
||||
fa-icon="fa-server"
|
||||
placeholder="example.com"
|
||||
required="true">
|
||||
</text-setting>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<button class="btn btn-default m-t-lg" ng-click="detectFillUrl()" title="{{ 'app.admin.settings.general.auto_fill' | translate }}">
|
||||
<i class="fa fa-search"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
@ -51,8 +51,8 @@ class ApplicationController < ActionController::Base
|
||||
|
||||
def default_url_options
|
||||
{
|
||||
host: Setting.get('base_url_host'),
|
||||
protocol: Setting.get('base_url_protocol')
|
||||
host: Rails.application.secrets.default_host,
|
||||
protocol: Rails.application.secrets.default_protocol
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -90,8 +90,6 @@ class Setting < ApplicationRecord
|
||||
recaptcha_secret_key
|
||||
feature_tour_display
|
||||
email_from
|
||||
base_url_protocol
|
||||
base_url_host
|
||||
disqus_shortname] }
|
||||
def value
|
||||
last_value = history_values.order(HistoryValue.arel_table['created_at'].desc).first
|
||||
|
@ -27,7 +27,7 @@
|
||||
Fablab.spacesModule = ('<%= Setting.get('spaces_module') %>' === 'true');
|
||||
Fablab.withoutOnlinePayment = ('<%= Rails.application.secrets.fablab_without_online_payments %>' === 'true');
|
||||
Fablab.fablabWithoutWallet = ('<%= Rails.application.secrets.fablab_without_wallet %>' === 'true');
|
||||
Fablab.baseHostUrl = "<%= Setting.get('base_url_host') %>";
|
||||
Fablab.defaultHost = "<%= Rails.application.secrets.default_host %>";
|
||||
Fablab.trackingId = "<%= Setting.get('tracking_id') %>";
|
||||
Fablab.superadminId = parseInt("<%= User.superadmin&.id %>", 10);
|
||||
|
||||
|
@ -30,8 +30,8 @@ Rails.application.configure do
|
||||
end
|
||||
|
||||
config.action_controller.default_url_options = {
|
||||
host: ->(*) { Setting.get('base_url_host') },
|
||||
protocol: ->(*) { Setting.get('base_url_protocol') }
|
||||
host: Rails.application.secrets.default_host,
|
||||
protocol: Rails.application.secrets.default_protocol
|
||||
}
|
||||
|
||||
# Store uploaded files on the local file system (see config/storage.yml for options)
|
||||
@ -46,8 +46,8 @@ Rails.application.configure do
|
||||
config.action_mailer.smtp_settings = { address: 'fabmanager-mailcatcher', port: 1025 }
|
||||
config.action_mailer.raise_delivery_errors = false
|
||||
config.action_mailer.default_url_options = {
|
||||
host: ->(*) { Setting.get('base_url_host') },
|
||||
protocol: ->(*) { Setting.get('base_url_protocol') }
|
||||
host: Rails.application.secrets.default_host,
|
||||
protocol: Rails.application.secrets.default_protocol
|
||||
}
|
||||
|
||||
# Print deprecation notices to the Rails logger.
|
||||
|
@ -21,8 +21,8 @@ Rails.application.configure do
|
||||
# config.require_master_key = true
|
||||
|
||||
config.action_controller.default_url_options = {
|
||||
host: ->(*) { Setting.get('base_url_host') },
|
||||
protocol: ->(*) { Setting.get('base_url_protocol') }
|
||||
host: Rails.application.secrets.default_host,
|
||||
protocol: Rails.application.secrets.default_protocol
|
||||
}
|
||||
|
||||
# Disable serving static files from the `/public` folder by default since
|
||||
@ -78,8 +78,8 @@ Rails.application.configure do
|
||||
config.action_mailer.perform_caching = false
|
||||
|
||||
config.action_mailer.default_url_options = {
|
||||
host: ->(*) { Setting.get('base_url_host') },
|
||||
protocol: ->(*) { Setting.get('base_url_protocol') }
|
||||
host: Rails.application.secrets.default_host,
|
||||
protocol: Rails.application.secrets.default_protocol
|
||||
}
|
||||
# config.action_mailer.perform_deliveries = true
|
||||
# config.action_mailer.raise_delivery_errors = false
|
||||
|
@ -17,8 +17,8 @@ Rails.application.configure do
|
||||
config.action_controller.perform_caching = true
|
||||
|
||||
config.action_controller.default_url_options = {
|
||||
host: ->(*) { Setting.get('base_url_host') },
|
||||
protocol: ->(*) { Setting.get('base_url_protocol') }
|
||||
host: Rails.application.secrets.default_host,
|
||||
protocol: Rails.application.secrets.default_protocol
|
||||
}
|
||||
|
||||
# Enable Rack::Cache to put a simple HTTP cache in front of your application
|
||||
|
@ -25,8 +25,8 @@ Rails.application.configure do
|
||||
config.action_controller.perform_caching = false
|
||||
|
||||
config.action_controller.default_url_options = {
|
||||
host: ->(*) { Setting.get('base_url_host') },
|
||||
protocol: ->(*) { Setting.get('base_url_protocol') }
|
||||
host: Rails.application.secrets.default_host,
|
||||
protocol: Rails.application.secrets.default_protocol
|
||||
}
|
||||
|
||||
# Raise exceptions instead of rendering exception templates.
|
||||
|
@ -1057,9 +1057,6 @@ en:
|
||||
recaptcha_secret_key: "reCAPTCHA Secret Key"
|
||||
feature_tour_display: "feature tour display"
|
||||
email_from: "expeditor's address"
|
||||
base_url_protocol: "site protocol"
|
||||
base_url_host: "site host"
|
||||
base_url: "site url"
|
||||
disqus_shortname: "Disqus shortname"
|
||||
general:
|
||||
general: "General"
|
||||
@ -1094,11 +1091,6 @@ en:
|
||||
email: "Email"
|
||||
email_info: "The email address from which notifications will be sent. You can use a non-existing address (like noreply@...) or an existing address if you want to allow your members to reply to the notifications they receive."
|
||||
email_from: "Expeditor's address"
|
||||
site_url: "Site url"
|
||||
auto_fill: "Detect and fill"
|
||||
site_url_info_html: "<p>Your members will receive email notifications containing links to this instance of Fab-manager. You must properly configure the URL of this instance, to prevent broken links.</p><p>To prevent any mistake, please favor the use of the button <strong>{NAME}</strong> below.</p><p>The host name is also used for visits statistics.</p>"
|
||||
protocol: "Protocol"
|
||||
host: "Host"
|
||||
privacy:
|
||||
title: "Privacy"
|
||||
privacy_policy: "Privacy policy"
|
||||
|
@ -1057,9 +1057,6 @@ fr:
|
||||
recaptcha_secret_key: "clef secrète reCAPTCHA"
|
||||
feature_tour_display: "l'affichage des visites guidées"
|
||||
email_from: "l'adresse de l'expéditeur"
|
||||
base_url_protocol: "protocole du site"
|
||||
base_url_host: "l'hôte du site"
|
||||
base_url: "l'url du site"
|
||||
disqus_shortname: "nom court Disqus"
|
||||
general:
|
||||
general: "Général"
|
||||
@ -1094,11 +1091,6 @@ fr:
|
||||
email: "Courriel"
|
||||
email_info: "L'adresse de courriel depuis laquelle les notifications seront envoyées. Vous pouvez utiliser une adresse qui n'existe pas (comme ne-pas-repondre@...) ou une adresse existante si vous voulez que vos membres puisse répondre aux notifications qu'ils reçoivent."
|
||||
email_from: "Adresse de l'expéditeur"
|
||||
site_url: "URL du site"
|
||||
auto_fill: "Détecter et remplir"
|
||||
site_url_info_html: "<p>Vos membres recevront les notifications par courriel contenant des liens vers cette instance de Fab-manager. Vous devez configurer correctement l'URL de cette instance, pour éviter les liens cassés.</p><p>Pour éviter toute erreur, veuillez favoriser l'utilisation du bouton <strong>{NAME}</strong> ci-dessous.</p><p>Le nom d'hôte est également utilisé pour les statistiques de visites.</p>"
|
||||
protocol: "Protocole"
|
||||
host: "Hôte"
|
||||
privacy:
|
||||
title: "Confidentialité"
|
||||
privacy_policy: "Politique de confidentialité"
|
||||
|
@ -18,6 +18,8 @@ development:
|
||||
fablab_without_online_payments: <%= ENV["FABLAB_WITHOUT_ONLINE_PAYMENT"] %>
|
||||
fablab_without_wallet: <%= ENV["FABLAB_WITHOUT_WALLET"] %>
|
||||
user_confirmation_needed_to_sign_in: <%= ENV["USER_CONFIRMATION_NEEDED_TO_SIGN_IN"] %>
|
||||
default_host: <%= ENV["DEFAULT_HOST"] %>
|
||||
default_protocol: <%= ENV["DEFAULT_PROTOCOL"] %>
|
||||
time_zone: <%= ENV["TIME_ZONE"] %>
|
||||
week_starting_day: <%= ENV["WEEK_STARTING_DAY"] %>
|
||||
d3_date_format: <%= ENV["D3_DATE_FORMAT"].dump %> # .dump is needed as the value may start by a '%', see https://github.com/tenderlove/psych/issues/75
|
||||
@ -52,6 +54,8 @@ test:
|
||||
fablab_without_online_payments: false
|
||||
fablab_without_wallet: false
|
||||
user_confirmation_needed_to_sign_in: <%= ENV["USER_CONFIRMATION_NEEDED_TO_SIGN_IN"] %>
|
||||
default_host: <%= ENV["DEFAULT_HOST"] %>
|
||||
default_protocol: <%= ENV["DEFAULT_PROTOCOL"] %>
|
||||
time_zone: Paris
|
||||
week_starting_day: monday
|
||||
d3_date_format: '%d/%m/%y'
|
||||
@ -86,6 +90,8 @@ staging:
|
||||
fablab_without_online_payments: <%= ENV["FABLAB_WITHOUT_ONLINE_PAYMENT"] %>
|
||||
fablab_without_wallet: <%= ENV["FABLAB_WITHOUT_WALLET"] %>
|
||||
user_confirmation_needed_to_sign_in: <%= ENV["USER_CONFIRMATION_NEEDED_TO_SIGN_IN"] %>
|
||||
default_host: <%= ENV["DEFAULT_HOST"] %>
|
||||
default_protocol: <%= ENV["DEFAULT_PROTOCOL"] %>
|
||||
delivery_method: <%= ENV['DELIVERY_METHOD'] %>
|
||||
smtp_address: <%= ENV["SMTP_ADDRESS"] %>
|
||||
smtp_port: <%= ENV["SMTP_PORT"] %>
|
||||
@ -131,6 +137,8 @@ production:
|
||||
fablab_without_online_payments: <%= ENV["FABLAB_WITHOUT_ONLINE_PAYMENT"] %>
|
||||
fablab_without_wallet: <%= ENV["FABLAB_WITHOUT_WALLET"] %>
|
||||
user_confirmation_needed_to_sign_in: <%= ENV["USER_CONFIRMATION_NEEDED_TO_SIGN_IN"] %>
|
||||
default_host: <%= ENV["DEFAULT_HOST"] %>
|
||||
default_protocol: <%= ENV["DEFAULT_PROTOCOL"] %>
|
||||
delivery_method: <%= ENV['DELIVERY_METHOD'] %>
|
||||
smtp_address: <%= ENV["SMTP_ADDRESS"] %>
|
||||
smtp_port: <%= ENV["SMTP_PORT"] %>
|
||||
|
@ -859,10 +859,6 @@ Setting.set('feature_tour_display', 'once') unless Setting.find_by(name: 'featur
|
||||
|
||||
Setting.set('email_from', 'noreply@fab-manager.com') unless Setting.find_by(name: 'email_from').try(:value)
|
||||
|
||||
Setting.set('base_url_host', 'demo.fab-manager.com') unless Setting.find_by(name: 'base_url_host').try(:value)
|
||||
|
||||
Setting.set('base_url_protocol', 'https') unless Setting.find_by(name: 'base_url_protocol').try(:value)
|
||||
|
||||
if StatisticCustomAggregation.count.zero?
|
||||
# available reservations hours for machines
|
||||
machine_hours = StatisticType.find_by(key: 'hour', statistic_index_id: 2)
|
||||
|
@ -105,12 +105,20 @@ Set to 'false' if you don't want this behaviour.
|
||||
|
||||
Configure the Rails' Action Mailer delivery method.
|
||||
See http://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration for more details.
|
||||
</a><a name="SMTP_ADDRESS"></a><a name="SMTP_PORT"></a><a name="SMTP_USER_NAME"></a><a name="SMTP_PASSWORD"></a><a name="SMTP_AUTHENTICATION"></a><a name="SMTP_ENABLE_STARTTLS_AUTO"></a><a name="SMTP_OPENSSL_VERIFY_MODE"></a><a name="SMTP_TLS"></a>
|
||||
<a name="SMTP_ADDRESS"></a><a name="SMTP_PORT"></a><a name="SMTP_USER_NAME"></a><a name="SMTP_PASSWORD"></a><a name="SMTP_AUTHENTICATION"></a><a name="SMTP_ENABLE_STARTTLS_AUTO"></a><a name="SMTP_OPENSSL_VERIFY_MODE"></a><a name="SMTP_TLS"></a>
|
||||
|
||||
SMTP_ADDRESS, SMTP_PORT, SMTP_USER_NAME, SMTP_PASSWORD, SMTP_AUTHENTICATION, SMTP_ENABLE_STARTTLS_AUTO, SMTP_OPENSSL_VERIFY_MODE & SMTP_TLS
|
||||
|
||||
When DELIVERY_METHOD is set to **smtp**, configure the SMTP server parameters.
|
||||
See https://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration for more details.
|
||||
<a name="DEFAULT_HOST"></a><a name="DEFAULT_PROTOCOL"></a>
|
||||
|
||||
DEFAULT_HOST, DEFAULT_PROTOCOL
|
||||
|
||||
Your members will receive email notifications containing links to your of Fab-manager.
|
||||
You must properly configure these variables to match URL of this instance, to prevent broken links.
|
||||
Typically, `DEFAULT_PROTOCOL` will be `https` (`http` if you are in development, or if you set `ALLOW_INSECURE_HTTP`).
|
||||
The variable `DEFAULT_HOST` should be your domain name (eg. fabmanager.example.com), and is also used for visits statistics (configuration of Google Analytics).
|
||||
<a name="LOG_LEVEL"></a>
|
||||
|
||||
LOG_LEVEL
|
||||
|
@ -22,6 +22,10 @@ FABLAB_WITHOUT_WALLET=false
|
||||
|
||||
USER_CONFIRMATION_NEEDED_TO_SIGN_IN=false
|
||||
|
||||
# Configure carefully!
|
||||
DEFAULT_HOST=localhost:5000
|
||||
DEFAULT_PROTOCOL=http
|
||||
|
||||
# Email config
|
||||
DELIVERY_METHOD=smtp
|
||||
SMTP_ADDRESS=
|
||||
|
@ -4,7 +4,7 @@
|
||||
class FabHub
|
||||
def self.version_check_payload
|
||||
uuid = Setting.get('uuid')
|
||||
origin = Setting.get('origin') || "#{Setting.get('base_url_protocol')}://#{Setting.get('base_url_host')}"
|
||||
origin = Setting.get('origin') || "#{Rails.application.secrets.default_protocol}://#{Rails.application.secrets.default_host}"
|
||||
{
|
||||
uuid: uuid,
|
||||
origin: origin,
|
||||
|
@ -120,8 +120,6 @@ namespace :fablab do
|
||||
%w[_ RECAPTCHA_SECRET_KEY recaptcha_secret_key],
|
||||
%w[_ FEATURE_TOUR_DISPLAY feature_tour_display once],
|
||||
%w[_ DEFAULT_MAIL_FROM email_from],
|
||||
%w[_ DEFAULT_HOST base_url_host demo.fab-manager.com],
|
||||
%w[_ DEFAULT_PROTOCOL base_url_protocol https],
|
||||
%w[_ DISQUS_SHORTNAME disqus_shortname]
|
||||
]
|
||||
|
||||
|
@ -16,6 +16,9 @@ FABLAB_WITHOUT_WALLET=false
|
||||
SLOT_DURATION=60
|
||||
FEATURE_TOUR_DISPLAY=once
|
||||
|
||||
DEFAULT_HOST=demo.fab-manager.com
|
||||
DEFAULT_PROTOCOL=http
|
||||
|
||||
DELIVERY_METHOD=smtp
|
||||
SMTP_ADDRESS=smtp.sendgrid.net
|
||||
SMTP_PORT=587
|
||||
|
@ -235,7 +235,7 @@ configure_env_file()
|
||||
local doc variables secret
|
||||
doc=$(\curl -sSL https://raw.githubusercontent.com/sleede/fab-manager/master/doc/environment.md)
|
||||
variables=(STRIPE_API_KEY STRIPE_PUBLISHABLE_KEY STRIPE_CURRENCY INVOICE_PREFIX FABLAB_WITHOUT_ONLINE_PAYMENT FABLAB_WITHOUT_WALLET \
|
||||
USER_CONFIRMATION_NEEDED_TO_SIGN_IN DELIVERY_METHOD SMTP_ADDRESS SMTP_PORT SMTP_USER_NAME SMTP_PASSWORD SMTP_AUTHENTICATION \
|
||||
USER_CONFIRMATION_NEEDED_TO_SIGN_IN DEFAULT_HOST DEFAULT_PROTOCOL DELIVERY_METHOD SMTP_ADDRESS SMTP_PORT SMTP_USER_NAME SMTP_PASSWORD SMTP_AUTHENTICATION \
|
||||
SMTP_ENABLE_STARTTLS_AUTO SMTP_OPENSSL_VERIFY_MODE SMTP_TLS \
|
||||
LOG_LEVEL ALLOWED_EXTENSIONS ALLOWED_MIME_TYPES MAX_IMAGE_SIZE MAX_CAO_SIZE MAX_IMPORT_SIZE DISK_SPACE_MB_ALERT \
|
||||
SUPERADMIN_EMAIL APP_LOCALE RAILS_LOCALE MOMENT_LOCALE SUMMERNOTE_LOCALE ANGULAR_LOCALE FULLCALENDAR_LOCALE ELASTICSEARCH_LANGUAGE_ANALYZER TIME_ZONE \
|
||||
|
18
test/fixtures/history_values.yml
vendored
18
test/fixtures/history_values.yml
vendored
@ -629,21 +629,3 @@ history_value_65:
|
||||
created_at: 2020-06-01 11:12:21.255550000 Z
|
||||
updated_at: 2020-06-01 11:12:21.255550000 Z
|
||||
footprint:
|
||||
|
||||
history_value_66:
|
||||
id: 66
|
||||
setting_id: 66
|
||||
invoicing_profile_id: 1
|
||||
value: 'demo.fab-manager.com'
|
||||
created_at: 2020-06-01 17:34:41.422150000 Z
|
||||
updated_at: 2020-06-01 17:34:41.422150000 Z
|
||||
footprint:
|
||||
|
||||
history_value_67:
|
||||
id: 67
|
||||
setting_id: 67
|
||||
invoicing_profile_id: 1
|
||||
value: 'https'
|
||||
created_at: 2020-06-01 17:34:41.422150000 Z
|
||||
updated_at: 2020-06-01 17:34:41.422150000 Z
|
||||
footprint:
|
||||
|
13
test/fixtures/settings.yml
vendored
13
test/fixtures/settings.yml
vendored
@ -382,16 +382,3 @@ setting_65:
|
||||
name: email_from
|
||||
created_at: 2020-06-01 11:12:21.255550000 Z
|
||||
updated_at: 2020-06-01 11:12:21.255550000 Z
|
||||
|
||||
setting_66:
|
||||
id: 66
|
||||
name: base_url_host
|
||||
created_at: 2020-06-01 17:34:41.422150000 Z
|
||||
updated_at: 2020-06-01 17:34:41.422150000 Z
|
||||
|
||||
setting_67:
|
||||
id: 67
|
||||
name: base_url_protocol
|
||||
created_at: 2020-06-01 17:34:41.422150000 Z
|
||||
updated_at: 2020-06-01 17:34:41.422150000 Z
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user