summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/application.rb8
-rw-r--r--config/customization/README.md27
-rw-r--r--config/defaults.yml56
-rw-r--r--config/deploy.rb.example2
-rw-r--r--config/initializers/customization.rb36
5 files changed, 126 insertions, 3 deletions
diff --git a/config/application.rb b/config/application.rb
index 8587ffc..2c9c55a 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -78,12 +78,18 @@ module LeapWeb
# Enable the asset pipeline
config.assets.enabled = true
- config.assets.initialize_on_precompile = false
+ config.assets.initialize_on_precompile = true # don't change this (see customization.rb)
# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'
# Set to false in order to see asset requests in the log
config.quiet_assets = true
+
+ ##
+ ## CUSTOMIZATION
+ ## see initializers/customization.rb
+ ##
+ config.paths['app/views'].unshift "config/customization/views"
end
end
diff --git a/config/customization/README.md b/config/customization/README.md
new file mode 100644
index 0000000..9c3e434
--- /dev/null
+++ b/config/customization/README.md
@@ -0,0 +1,27 @@
+Customizing LEAP Webapp
+============================================
+
+By default, this directory is empty. Any file you place here will override the default files for the application.
+
+For example:
+
+ stylesheets/ -- overrides files Rails.root/app/assets/stylesheets
+ tail.scss -- included before all others
+ head.scss -- included after all others
+
+ public/ -- overrides files in Rails.root/public
+ favicon.ico -- custom favicon
+ img/ -- customary directory to put images in
+
+ views/ -- overrides files Rails.root/app/views
+ home/
+ index.html.haml -- this file is what shows up on the home page
+
+ locales/ -- overrides files in Rails.root/config/locales
+ en.yml -- overrides for English
+ de.yml -- overrides for German
+ and so on...
+
+For most changes, the web application must be restarted after any changes are made to the customization directory.
+
+Sometimes a `rake tmp:clear` and a rails restart is required to pick up a new stylesheet.
diff --git a/config/defaults.yml b/config/defaults.yml
index 8d81668..260915e 100644
--- a/config/defaults.yml
+++ b/config/defaults.yml
@@ -13,34 +13,88 @@ cert_options: &cert_options
limited_cert_prefix: "LIMITED"
unlimited_cert_prefix: "UNLIMITED"
+downloads: &downloads
+ client_download_domain: https://downloads.leap.se
+ available_clients:
+ - linux32
+ - linux64
+ - osx
+ - windows
+ - android
+ download_paths:
+ android: /client/android/Bitmask-Android-latest.apk
+ linux: /client/linux
+ linux32: /client/linux/Bitmask-linux32-latest.tar.bz2
+ linux64: /client/linux/Bitmask-linux64-latest.tar.bz2
+ osx: /client/osx/Bitmask-OSX-latest.dmg
+ windows: /client/windows/Bitmask-win32-latest.zip
+ other: /client
+
common: &common
force_ssl: false
pagination_size: 30
auth:
token_expires_after: 60
+ # handles that will be blocked from being used as logins or email aliases
+ # in addition to the ones in /etc/passwd and http://tools.ietf.org/html/rfc2142
+ handle_blacklist: [certmaster, ssladmin, arin-admin, administrator, www-data, maildrop]
+ # handles that will be allowed despite being in /etc/passwd or rfc2142
+ handle_whitelist: []
+ # actions enabled in the account settings
+ # see /users/app/views/users/_edit.html.haml for a list.
+ user_actions: ['destroy_account']
+ admin_actions: ['change_pgp_key', 'change_service_level', 'destroy_account']
+
+service_levels: &service_levels
+ service_levels:
+ 0:
+ name: anonymous
+ cert_prefix: "LIMITED"
+ description: "anonymous account, with rate limited VPN"
+ 1:
+ name: free
+ cert_prefix: "LIMITED"
+ description: "free account, with rate limited VPN"
+ cost: 0
+ quota: 100
+ 2:
+ name: premium
+ cert_prefix: "UNLIMITED"
+ description: "premium account, with unlimited vpn"
+ cost:
+ USD: 10
+ EUR: 10
+ default_service_level: 1
development:
+ <<: *downloads
<<: *dev_ca
<<: *cert_options
<<: *common
+ <<: *service_levels
admins: [blue, admin, admin2]
domain: example.org
secret_token: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
payment: []
+ reraise_errors: true
test:
+ <<: *downloads
<<: *dev_ca
<<: *cert_options
<<: *common
+ <<: *service_levels
admins: [admin, admin2]
domain: test.me
secret_token: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
payment: [billing]
+ reraise_errors: true
production:
+ <<: *downloads
<<: *cert_options
<<: *common
admins: []
domain: example.net
payment: []
-# logfile: /path/to/your/logs
+ # logfile: /path/to/your/logs
diff --git a/config/deploy.rb.example b/config/deploy.rb.example
index 9e54c22..1fd4b8c 100644
--- a/config/deploy.rb.example
+++ b/config/deploy.rb.example
@@ -3,7 +3,7 @@ require "bundler/capistrano"
set :application, "webapp"
set :scm, :git
-set :repository, "git://leap.se/leap_web"
+set :repository, "https://leap.se/git/leap_web"
set :branch, "master"
set :deploy_via, :remote_cache
diff --git a/config/initializers/customization.rb b/config/initializers/customization.rb
new file mode 100644
index 0000000..bc9c834
--- /dev/null
+++ b/config/initializers/customization.rb
@@ -0,0 +1,36 @@
+#
+# When deploying, common customizations can be dropped in config/customizations. This initializer makes this work.
+#
+customization_directory = "#{Rails.root}/config/customization"
+
+#
+# Set customization views as the first view path
+#
+# Rails.application.config.paths['app/views'].unshift "config/customization/views"
+# (For some reason, this does not work here. See application.rb for where this is actually called.)
+
+#
+# Set customization stylesheets as the first asset path
+#
+# Some notes:
+#
+# * This cannot go in application.rb, as far as I can tell. In application.rb, the default paths
+# haven't been loaded yet, so the path we add will always end up at the end unless we add it here.
+#
+# * For this to work, config.assets.initialize_on_precompile MUST be set to true, otherwise
+# this initializer will never get called in production mode when the assets are precompiled.
+#
+Rails.application.config.assets.paths.unshift "#{customization_directory}/stylesheets"
+
+#
+# Copy files to public
+#
+if !defined?(RAKE) && Dir.exists?("#{customization_directory}/public")
+ require 'fileutils'
+ FileUtils.cp_r("#{customization_directory}/public/.", "#{Rails.root}/public")
+end
+
+#
+# Add I18n path
+#
+Rails.application.config.i18n.load_path += Dir["#{customization_directory}/locales/*.{rb,yml,yaml}"]