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