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

Unified Diff: datahopper/go/datahopper/main.go

Issue 813443002: Overhaul database package (Closed) Base URL: https://skia.googlesource.com/buildbot@master
Patch Set: Assume the MySQL password is "" when running locally Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « datahopper/go/buildbot_migratedb/main.go ('k') | go/buildbot/buildbot_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: datahopper/go/datahopper/main.go
diff --git a/datahopper/go/datahopper/main.go b/datahopper/go/datahopper/main.go
index 101db8ee7f1f6388ed3c6db8883119fa209a78fc..515ac14f1b633fe7ac5123b2e82a0a5d60f6e3e5 100644
--- a/datahopper/go/datahopper/main.go
+++ b/datahopper/go/datahopper/main.go
@@ -28,20 +28,23 @@ const (
// flags
var (
graphiteServer = flag.String("graphite_server", "localhost:2003", "Where is Graphite metrics ingestion server running.")
- useMetadata = flag.Bool("use_metadata", true, "Load sensitive values from metadata not from flags.")
influxDbHost = flag.String("influxdb_host", "localhost:8086", "The InfluxDB hostname.")
influxDbName = flag.String("influxdb_name", "root", "The InfluxDB username.")
influxDbPassword = flag.String("influxdb_password", "root", "The InfluxDB password.")
influxDbDatabase = flag.String("influxdb_database", "", "The InfluxDB database.")
workdir = flag.String("workdir", ".", "Working directory used by data processors.")
- testing = flag.Bool("testing", false, "Whether we're running in non-production, testing mode.")
+ local = flag.Bool("local", false, "Running locally if true. As opposed to in production.")
)
func main() {
+ // Setup DB flags.
+ database.SetupFlags(buildbot.PROD_DB_HOST, buildbot.PROD_DB_PORT, database.USER_RW, buildbot.PROD_DB_NAME)
+
+ // Global init to initialize glog and parse arguments.
common.InitWithMetrics("datahopper", *graphiteServer)
// Prepare the InfluxDB credentials. Load from metadata if appropriate.
- if *useMetadata {
+ if !*local {
*influxDbName = metadata.MustGet(INFLUXDB_NAME_METADATA_KEY)
*influxDbPassword = metadata.MustGet(INFLUXDB_PASSWORD_METADATA_KEY)
}
@@ -62,12 +65,7 @@ func main() {
go autoroll_ingest.LoadAutoRollData(dbClient, *workdir)
go func() {
// Initialize the buildbot database.
- var conf *database.DatabaseConfig
- if *testing {
- conf = buildbot.LocalMySQLTestDatabaseConfig("test_user", "")
- } else {
- conf = buildbot.ProdDatabaseConfig(false)
- }
+ conf, err := database.ConfigFromFlagsAndMetadata(*local, buildbot.MigrationSteps())
if err := buildbot.InitDB(conf); err != nil {
glog.Fatal(err)
}
« no previous file with comments | « datahopper/go/buildbot_migratedb/main.go ('k') | go/buildbot/buildbot_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698