Skip to content

Commit

Permalink
Merge pull request scalyr#24 from femueller/master
Browse files Browse the repository at this point in the history
Allow to set custom scalyr_server via environment variable
  • Loading branch information
czerwingithub authored Aug 22, 2018
2 parents 86211bb + 064e8b8 commit 1da66d4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ command history. On Unix systems, you can add the following to a file like `.bas
The values for XXX, YYY, and ZZZ can be found at [scalyr.com/keys](https://www.scalyr.com/keys) -- look
for "Read Logs", "Read Config", and "Write Config" tokens, respectively.

Setting a custom Scalyr server can be done using the `--server` argument but also via environment variable:

export scalyr_server='https://eu.scalyr.com'

After adding these to `.bash_profile`, make sure to also paste them into your current console session,
so that they take effect immediately. Alternatively, run `source ~/.bash_profile`.

Expand Down
7 changes: 6 additions & 1 deletion scalyr
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,12 @@ def sendRequest(args, uri, parameterDict):
if verbose:
print_stderr("Using arguments: %s" % args)

# Allow to set custom scalyr_server via environment variable
serverAddress = args.server

if serverAddress is None:
serverAddress = os.environ.get('scalyr_server', 'https://www.scalyr.com')

useSSL = True
if serverAddress.startswith("http://"):
useSSL = False
Expand Down Expand Up @@ -624,7 +629,7 @@ if __name__ == '__main__':
parser.add_argument('command', choices=all_commands.keys(),
help='specifies the action to be performed')
parser.add_argument('--version', action='version', version='%(prog)s ' + TOOL_VERSION)
parser.add_argument('--server', default='https://www.scalyr.com',
parser.add_argument('--server',
help='URL for the Scalyr API server. Defaults to https://www.scalyr.com. If you are using eu.scalyr.com then this should be set to https://eu.scalyr.com.')
parser.add_argument('--token', default='',
help='API access token')
Expand Down

0 comments on commit 1da66d4

Please sign in to comment.