This repository has been archived by the owner on Jan 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10770 from alphagov/GOVUK_DATA_SYNC_PERIOD
Expose GOVUK_DATA_SYNC_PERIOD ENV variable for govuk_app_config
- Loading branch information
Showing
4 changed files
with
54 additions
and
17 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
modules/govuk/lib/puppet/parser/functions/data_sync_times.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
module Puppet::Parser::Functions | ||
newfunction(:data_sync_times, :type => :rvalue, :doc => <<-EOS | ||
Return information about the data sync times, depending on the argument passed | ||
EOS | ||
) do |args| | ||
start_hour = 22 | ||
start_minute = 0 | ||
finish_hour = 8 | ||
finish_minute = 0 | ||
expected_args = 1 | ||
|
||
if args.size != expected_args | ||
raise ArgumentError, "data_sync_times: Wrong number of arguments " + | ||
"(given #{args.size}, expected #{expected_args})" | ||
end | ||
|
||
type = args[0] | ||
|
||
case type | ||
when 'time_range' | ||
"#{start_hour}:#{start_minute}-#{finish_hour}:#{finish_minute}" | ||
when 'start_time' | ||
"#{start_hour}:#{start_minute}" | ||
when 'start_hour' | ||
start_hour | ||
when 'start_minute' | ||
start_minute | ||
when 'finish_time' | ||
"#{finish_hour}:#{finish_minute}" | ||
when 'finish_hour' | ||
finish_hour | ||
when 'finish_minute' | ||
finish_minute | ||
else | ||
raise ArgumentError, "data_sync_times: Unknown argument #{type}" | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters