Page MenuHomeDevCentral

D1797.id.diff
No OneTemporary

D1797.id.diff

diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -21,6 +21,13 @@
docker run -dt -p 8080:4567 -e JENKINS_URL=http://ci.domain.tld nasqueron/tommy
```
+### Exit codes
+
+The app uses the following exit codes:
+
+* 0: regular exit
+* 1: required configuration environment variable is missing
+
### Contributors
* Written by [@arfon](http://twitter.com/arfon "Twitter")
diff --git a/tommy.rb b/tommy.rb
--- a/tommy.rb
+++ b/tommy.rb
@@ -32,7 +32,15 @@
# Environment
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-JENKINS_URL = ENV['JENKINS_URL'] || 'http://username:password@jenkins.domain.tld'
+begin
+ JENKINS_URL = ENV.fetch('JENKINS_URL')
+rescue KeyError
+ $stderr.write %(You must define JENKINS_URL to your Jenkins instance URL.
+
+If you need to pass credentials, you can use the syntax http://username:password@jenkins.domain.tld.
+)
+ exit 1
+end
# -------------------------------------------------------------
# Project class

File Metadata

Mime Type
text/plain
Expires
Sun, Feb 2, 08:56 (20 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2390798
Default Alt Text
D1797.id.diff (1005 B)

Event Timeline