app/server.rb in sqlui-0.1.79 vs app/server.rb in sqlui-0.1.80
- old
+ new
@@ -113,22 +113,25 @@
erb :databases, locals: { config: config, resource_path_map: resource_path_map }
end
github_cache = create_github_cache
config.database_configs.each do |database|
- # Prefetch all trees on startup. This should happen before the health endpoint is available.
if (saved_config = database.saved_config)
tree_client = Github::TreeClient.new(
access_token: database.saved_config.token,
cache: github_cache,
logger: Sqlui.logger
)
- tree_client.get_tree(
- owner: saved_config.owner,
- repo: saved_config.repo,
- ref: saved_config.branch,
- regex: saved_config.regex
- )
+ # Prefetch all trees on startup. This should happen before the health endpoint is available.
+ unless ENV.fetch('DISABLE_PREFETCH', '0') == '1'
+ Sqlui.logger.info 'prefetch'
+ tree_client.get_tree(
+ owner: saved_config.owner,
+ repo: saved_config.repo,
+ ref: saved_config.branch,
+ regex: saved_config.regex
+ )
+ end
end
get "#{config.base_url_path}/#{database.url_path}/?" do
redirect "#{database.url_path}/query", 301
end