~unity-api-team/unity-scope-snappy/add_go_gettext

« back to all changes in this revision

Viewing changes to main.go

  • Committer: Tarmac
  • Author(s): Kyle Fazzari
  • Date: 2015-06-26 17:51:40 UTC
  • mfrom: (19.1.1 unity-scope-snappy)
  • Revision ID: tarmac-20150626175140-2h4bjv0mys7x4qav
Change command-line flag for WebDM URL to an environment variable.

Approved by PS Jenkins bot, Rodney Dawes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
package main
2
2
 
3
3
import (
4
 
        "flag"
 
4
        "os"
5
5
        "launchpad.net/unity-scope-snappy/internal/launchpad.net/go-unityscopes/v2"
6
6
        "launchpad.net/unity-scope-snappy/store"
7
7
        "log"
9
9
 
10
10
// main is the entry point of the scope.
11
11
//
12
 
// Command-line parameters:
13
 
// - webdm=address[:port] on which WebDM is listening
 
12
// Supported environment variables:
 
13
// - WEBDM_URL: address[:port] on which WebDM is listening
14
14
func main() {
15
 
        webdmAddressParameter := flag.String("webdm", "", "WebDM address[:port]")
16
 
        flag.Parse()
17
 
 
18
 
        scope, err := store.NewScope(*webdmAddressParameter)
 
15
        scope, err := store.NewScope(os.Getenv("WEBDM_URL"))
19
16
        if err != nil {
20
17
                log.Printf("unity-scope-snappy: Unable to create scope: %s", err)
21
18
                return