Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: common/tsmon/iface.go

Issue 2225933003: tsmon: read hostname and region from config file (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The LUCI Authors. All rights reserved. 1 // Copyright 2015 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 package tsmon 5 package tsmon
6 6
7 import ( 7 import (
8 "fmt" 8 "fmt"
9 "net/http" 9 "net/http"
10 "net/url" 10 "net/url"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 return err 92 return err
93 case mon == nil: 93 case mon == nil:
94 return nil // tsmon is disabled 94 return nil // tsmon is disabled
95 } 95 }
96 96
97 // Monitoring is enabled, so get the expensive default values for hostna me, 97 // Monitoring is enabled, so get the expensive default values for hostna me,
98 // etc. 98 // etc.
99 if config.AutoGenHostname { 99 if config.AutoGenHostname {
100 fl.Target.AutoGenHostname = true 100 fl.Target.AutoGenHostname = true
101 } 101 }
102 if config.Hostname != "" {
103 fl.Target.DeviceHostname = config.Hostname
dsansome 2016/08/09 03:28:22 I would expect flags to override values from a con
Sergey Berezin 2016/08/10 01:49:16 Good catch, thanks! Done.
104 fl.Target.TaskHostname = config.Hostname
105 }
106 if config.Region != "" {
107 fl.Target.DeviceRegion = config.Region
108 fl.Target.TaskRegion = config.Region
109 }
102 fl.Target.SetDefaultsFromHostname() 110 fl.Target.SetDefaultsFromHostname()
103 t, err := target.NewFromFlags(&fl.Target) 111 t, err := target.NewFromFlags(&fl.Target)
104 if err != nil { 112 if err != nil {
105 return err 113 return err
106 } 114 }
107 115
108 Initialize(c, mon, store.NewInMemory(t)) 116 Initialize(c, mon, store.NewInMemory(t))
109 117
110 state := GetState(c) 118 state := GetState(c)
111 if state.Flusher != nil { 119 if state.Flusher != nil {
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 case "": 213 case "":
206 // Let the Authenticator choose. 214 // Let the Authenticator choose.
207 break 215 break
208 216
209 default: 217 default:
210 authOpts.Method = auth.ServiceAccountMethod 218 authOpts.Method = auth.ServiceAccountMethod
211 authOpts.ServiceAccountJSONPath = credentials 219 authOpts.ServiceAccountJSONPath = credentials
212 } 220 }
213 return auth.NewAuthenticator(ctx, auth.SilentLogin, authOpts).Client() 221 return auth.NewAuthenticator(ctx, auth.SilentLogin, authOpts).Client()
214 } 222 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698