From 08546f4cc1a865762cbac5ce749875b5835f857a Mon Sep 17 00:00:00 2001 From: Will Rigby Date: Mon, 30 Nov 2015 21:27:43 -0500 Subject: [PATCH] Allow running Tilestream without HOME in the environment Falls back to serving tiles from ./tiles in case the HOME environment variable is undefined. --- commands/global.bones | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/commands/global.bones b/commands/global.bones index aefdcd4..d413261 100644 --- a/commands/global.bones +++ b/commands/global.bones @@ -1,5 +1,12 @@ var path = require('path'); +var defaultTilePath; +if(process.env.HOME !== undefined) { + defaultTilePath = path.join(process.env.HOME, 'Documents', 'MapBox', 'tiles'); +} else { + defaultTilePath = path.join(process.cwd(), 'tiles'); +} + Bones.Command.options['uiPort'] = { 'title': 'uiPort=[port]', 'description': 'UI server port.', @@ -25,7 +32,7 @@ Bones.Command.options['subdomains'] = { Bones.Command.options['tiles'] = { 'title': 'tiles=[path]', 'description': 'Path to tiles directory.', - 'default': path.join(process.env.HOME, 'Documents', 'MapBox', 'tiles') + 'default': defaultTilePath }; Bones.Command.options['accesslog'] = {