-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.rb
45 lines (36 loc) · 1.09 KB
/
config.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
require 'govuk_tech_docs'
require 'lib/api_reference_pages_extension'
require 'lib/helpers'
require 'lib/api_reference_helpers'
require 'lib/govuk_tech_docs/path_helpers'
# Check for broken links
require 'html-proofer'
GovukTechDocs.configure(self, livereload: { js_host: "localhost", host: "127.0.0.1" })
# Override config from environment variables
if ENV.has_key?("TECH_DOCS_HOST")
config[:tech_docs][:host] = ENV["TECH_DOCS_HOST"] || config[:tech_docs][:host]
end
if ENV.has_key?("TECH_DOCS_PREVENT_INDEXING")
config[:tech_docs][:prevent_indexing] = ENV["TECH_DOCS_PREVENT_INDEXING"]
end
if ENV.has_key?("TECH_DOCS_API_DOCS_PATH")
config[:tech_docs][:api_docs_path] = ENV["TECH_DOCS_API_DOCS_PATH"]
end
helpers Helpers
helpers ApiReferenceHelpers
activate :api_reference_pages
activate :relative_assets
set :relative_links, true
after_build do |builder|
begin
HTMLProofer.check_directory(config[:build_dir],
{
:disable_external => true,
:swap_urls => {
config[:tech_docs][:host] => "",
}
}).run
rescue RuntimeError => e
abort e.to_s
end
end