1 # frozen_string_literal: true
3 # Guard against deployments with old-style application.yml configurations
4 # Otherwise, admins might not be aware that they are now silently ignored
5 # and major problems could occur
6 # rubocop:disable Rails/Output, Rails/Exit
7 if Rails.root.join("config/application.yml").exist?
8 puts "The config/application.yml file is no longer supported."
10 puts "Default settings are now found in config/settings.yml and you"
11 puts "can override these in config/settings.local.yml."
13 puts "To prevent unexpected behaviour, please copy any custom"
14 puts "settings to config/settings.local.yml and then remove"
15 puts "your config/application.yml file."
18 # rubocop:enable Rails/Output, Rails/Exit
20 # Allowed status values
21 unless Object.const_defined?(:ALLOWED_STATUS)
23 "online", # online and operating normally
24 "api_readonly", # site online but API in read-only mode
25 "api_offline", # site online but API offline
26 "database_readonly", # database and site in read-only mode
27 "database_offline", # database offline with site in emergency mode
28 "gpx_offline" # gpx storage offline
32 Config.setup do |config|
33 # Name of the constant exposing loaded settings
34 config.const_name = "Settings"
36 # Ability to remove elements of the array set in earlier loaded settings file. For example value: '--'.
38 # config.knockout_prefix = nil
40 # Overwrite an existing value when merging a `nil` value.
41 # When set to `false`, the existing value is retained after merge.
43 # config.merge_nil_values = true
45 # Overwrite arrays found in previously loaded settings file. When set to `false`, arrays will be merged.
47 # config.overwrite_arrays = true
49 # Load environment variables from the `ENV` object and override any settings defined in files.
53 # Define ENV variable prefix deciding which variables to load into config.
55 config.env_prefix = "OPENSTREETMAP"
57 # What string to use as level separator for settings loaded from ENV variables. Default value of '.' works well
58 # with Heroku, but you might want to change it for example for '__' to easy override settings from command line, where
59 # using dots in variable names might not be allowed (eg. Bash).
61 config.env_separator = "_"
63 # Ability to process variables names:
65 # * :downcase - convert to lower case
67 config.env_converter = :downcase
69 # Parse numeric values as integers instead of strings.
71 # config.env_parse_values = true
73 # Validate presence and type of specific config values. Check https://github.com/dry-rb/dry-validation for details.
76 required(:api_version).filled(:str?)
77 required(:max_request_area).filled(:number?)
78 required(:max_note_request_area).filled(:number?)
79 required(:tracepoints_per_page).filled(:int?)
80 required(:max_number_of_way_nodes).filled(:int?)
81 required(:max_number_of_relation_members).filled(:int?)
82 required(:max_issues_count).filled(:int?)
83 required(:api_timeout).filled(:int?)
84 required(:user_account_deletion_delay).maybe(:number?)
85 required(:imagery_blacklist).maybe(:array?)
86 required(:status).filled(:str?, :included_in? => ALLOWED_STATUS)
87 required(:avatar_storage).filled(:str?)
88 required(:trace_file_storage).filled(:str?)
89 required(:trace_image_storage).filled(:str?)
90 required(:trace_icon_storage).filled(:str?)