Adds an option to rdm-mailhandler for reading the API key from a file (#4976).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7954 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
949c9a5b2f
commit
d3a2564964
@ -22,6 +22,10 @@
|
|||||||
# create: create a user account
|
# create: create a user account
|
||||||
# --no-permission-check disable permission checking when receiving
|
# --no-permission-check disable permission checking when receiving
|
||||||
# the email
|
# the email
|
||||||
|
# --key-file=PATH path to a file that contains the Redmine
|
||||||
|
# API key (use this option instead of --key
|
||||||
|
# if you don't the key to appear in the
|
||||||
|
# command line)
|
||||||
# --no-check-certificate do not check server certificate
|
# --no-check-certificate do not check server certificate
|
||||||
# -h, --help show this help
|
# -h, --help show this help
|
||||||
# -v, --verbose show extra information
|
# -v, --verbose show extra information
|
||||||
@ -87,6 +91,7 @@ class RedmineMailHandler
|
|||||||
[ '--verbose', '-v', GetoptLong::NO_ARGUMENT ],
|
[ '--verbose', '-v', GetoptLong::NO_ARGUMENT ],
|
||||||
[ '--url', '-u', GetoptLong::REQUIRED_ARGUMENT ],
|
[ '--url', '-u', GetoptLong::REQUIRED_ARGUMENT ],
|
||||||
[ '--key', '-k', GetoptLong::REQUIRED_ARGUMENT],
|
[ '--key', '-k', GetoptLong::REQUIRED_ARGUMENT],
|
||||||
|
[ '--key-file', GetoptLong::REQUIRED_ARGUMENT],
|
||||||
[ '--project', '-p', GetoptLong::REQUIRED_ARGUMENT ],
|
[ '--project', '-p', GetoptLong::REQUIRED_ARGUMENT ],
|
||||||
[ '--status', '-s', GetoptLong::REQUIRED_ARGUMENT ],
|
[ '--status', '-s', GetoptLong::REQUIRED_ARGUMENT ],
|
||||||
[ '--tracker', '-t', GetoptLong::REQUIRED_ARGUMENT],
|
[ '--tracker', '-t', GetoptLong::REQUIRED_ARGUMENT],
|
||||||
@ -104,6 +109,13 @@ class RedmineMailHandler
|
|||||||
self.url = arg.dup
|
self.url = arg.dup
|
||||||
when '--key'
|
when '--key'
|
||||||
self.key = arg.dup
|
self.key = arg.dup
|
||||||
|
when '--key-file'
|
||||||
|
begin
|
||||||
|
self.key = File.read(arg).strip
|
||||||
|
rescue Exception => e
|
||||||
|
$stderr.puts "Unable to read the key from #{arg}: #{e.message}"
|
||||||
|
exit 1
|
||||||
|
end
|
||||||
when '--help'
|
when '--help'
|
||||||
usage
|
usage
|
||||||
when '--verbose'
|
when '--verbose'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user