Class: Prefab::Options
- Inherits:
-
Object
- Object
- Prefab::Options
- Defined in:
- lib/prefab/options.rb
Defined Under Namespace
Modules: DATASOURCES, ON_INITIALIZATION_FAILURE, ON_NO_DEFAULT
Constant Summary collapse
- DEFAULT_LOG_FORMATTER =
proc { |severity, datetime, progname, msg| "#{severity.ljust(5)} #{datetime}:#{' ' if progname}#{progname} #{msg}\n" }
- DEFAULT_MAX_PATHS =
1_000
- DEFAULT_SYNC_INTERVAL =
60
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#collect_sync_interval ⇒ Object
readonly
Returns the value of attribute collect_sync_interval.
-
#initialization_timeout_sec ⇒ Object
readonly
Returns the value of attribute initialization_timeout_sec.
-
#log_formatter ⇒ Object
readonly
Returns the value of attribute log_formatter.
-
#log_prefix ⇒ Object
readonly
Returns the value of attribute log_prefix.
-
#logdev ⇒ Object
readonly
Returns the value of attribute logdev.
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
-
#on_init_failure ⇒ Object
readonly
Returns the value of attribute on_init_failure.
-
#on_no_default ⇒ Object
readonly
Returns the value of attribute on_no_default.
-
#prefab_api_url ⇒ Object
readonly
Returns the value of attribute prefab_api_url.
-
#prefab_config_classpath_dir ⇒ Object
readonly
Returns the value of attribute prefab_config_classpath_dir.
-
#prefab_config_override_dir ⇒ Object
readonly
Returns the value of attribute prefab_config_override_dir.
-
#prefab_envs ⇒ Object
readonly
Returns the value of attribute prefab_envs.
-
#prefab_grpc_url ⇒ Object
readonly
Returns the value of attribute prefab_grpc_url.
-
#shared_cache ⇒ Object
readonly
Returns the value of attribute shared_cache.
-
#stats ⇒ Object
readonly
Returns the value of attribute stats.
Instance Method Summary collapse
- #collect_max_paths ⇒ Object
-
#initialize(options = {}) ⇒ Options
constructor
A new instance of Options.
- #local_only? ⇒ Boolean
- #url_for_api_cdn ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Options
Returns a new instance of Options.
88 89 90 |
# File 'lib/prefab/options.rb', line 88 def initialize( = {}) init(**) end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
5 6 7 |
# File 'lib/prefab/options.rb', line 5 def api_key @api_key end |
#collect_sync_interval ⇒ Object (readonly)
Returns the value of attribute collect_sync_interval.
20 21 22 |
# File 'lib/prefab/options.rb', line 20 def collect_sync_interval @collect_sync_interval end |
#initialization_timeout_sec ⇒ Object (readonly)
Returns the value of attribute initialization_timeout_sec.
15 16 17 |
# File 'lib/prefab/options.rb', line 15 def initialization_timeout_sec @initialization_timeout_sec end |
#log_formatter ⇒ Object (readonly)
Returns the value of attribute log_formatter.
8 9 10 |
# File 'lib/prefab/options.rb', line 8 def log_formatter @log_formatter end |
#log_prefix ⇒ Object (readonly)
Returns the value of attribute log_prefix.
7 8 9 |
# File 'lib/prefab/options.rb', line 7 def log_prefix @log_prefix end |
#logdev ⇒ Object (readonly)
Returns the value of attribute logdev.
6 7 8 |
# File 'lib/prefab/options.rb', line 6 def logdev @logdev end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
11 12 13 |
# File 'lib/prefab/options.rb', line 11 def namespace @namespace end |
#on_init_failure ⇒ Object (readonly)
Returns the value of attribute on_init_failure.
16 17 18 |
# File 'lib/prefab/options.rb', line 16 def on_init_failure @on_init_failure end |
#on_no_default ⇒ Object (readonly)
Returns the value of attribute on_no_default.
14 15 16 |
# File 'lib/prefab/options.rb', line 14 def on_no_default @on_no_default end |
#prefab_api_url ⇒ Object (readonly)
Returns the value of attribute prefab_api_url.
12 13 14 |
# File 'lib/prefab/options.rb', line 12 def prefab_api_url @prefab_api_url end |
#prefab_config_classpath_dir ⇒ Object (readonly)
Returns the value of attribute prefab_config_classpath_dir.
18 19 20 |
# File 'lib/prefab/options.rb', line 18 def prefab_config_classpath_dir @prefab_config_classpath_dir end |
#prefab_config_override_dir ⇒ Object (readonly)
Returns the value of attribute prefab_config_override_dir.
17 18 19 |
# File 'lib/prefab/options.rb', line 17 def prefab_config_override_dir @prefab_config_override_dir end |
#prefab_envs ⇒ Object (readonly)
Returns the value of attribute prefab_envs.
19 20 21 |
# File 'lib/prefab/options.rb', line 19 def prefab_envs @prefab_envs end |
#prefab_grpc_url ⇒ Object (readonly)
Returns the value of attribute prefab_grpc_url.
13 14 15 |
# File 'lib/prefab/options.rb', line 13 def prefab_grpc_url @prefab_grpc_url end |
#shared_cache ⇒ Object (readonly)
Returns the value of attribute shared_cache.
10 11 12 |
# File 'lib/prefab/options.rb', line 10 def shared_cache @shared_cache end |
#stats ⇒ Object (readonly)
Returns the value of attribute stats.
9 10 11 |
# File 'lib/prefab/options.rb', line 9 def stats @stats end |
Instance Method Details
#collect_max_paths ⇒ Object
96 97 98 99 100 |
# File 'lib/prefab/options.rb', line 96 def collect_max_paths return 0 if !@collect_logs || local_only? @collect_max_paths end |
#local_only? ⇒ Boolean
92 93 94 |
# File 'lib/prefab/options.rb', line 92 def local_only? @prefab_datasources == DATASOURCES::LOCAL_ONLY end |
#url_for_api_cdn ⇒ Object
103 104 105 |
# File 'lib/prefab/options.rb', line 103 def url_for_api_cdn ENV['PREFAB_CDN_URL'] || "#{@prefab_api_url.gsub(/\./, '-')}.global.ssl.fastly.net" end |