func main() {
	flag.Parse()

	// Apply environment variable overrides, in order of preference:
	// 1. Command-line flags.
	// 2. Matching standard GAE env variables (see below)
	// 3. VM metadata entries (e.g., "instance/attributes/gae_project")
	mustSetenv(applicationEnv, *application)
	mustSetenv(moduleEnv, *module)
	mustSetenv(versionEnv, *version)
	mustSetenv(instanceEnv, *instance)
	mustSetenv(apiHostEnv, *apiHost)
	mustSetenv(apiPortEnv, *apiPort)

	ctx := gaeint.BackgroundContext()
	log.Fatalf("StartSync: %v", dtog.StartSync(ctx, *addr))
}
Exemplo n.º 2
0
func main() {
	flag.Parse()

	// Apply the overrides.
	// The final order of overrides will be:
	// 1. those cmd line parameters
	// 2. the matching standard GAE env variables (see below)
	// 3. the VM metadata entries ("instance/attributes/gae_project" for example.)
	if application != nil {
		if err := os.Setenv("GAE_LONG_APP_ID", *application); err != nil {
			panic(err)
		}
	}
	if module != nil {
		if err := os.Setenv("GAE_MODULE_NAME", *module); err != nil {
			panic(err)
		}
	}
	if version != nil {
		if err := os.Setenv("GAE_MODULE_VERSION", *version); err != nil {
			panic(err)
		}
	}
	if instance != nil {
		if err := os.Setenv("GAE_MODULE_INSTANCE", *instance); err != nil {
			panic(err)
		}
	}
	if apiHost != nil {
		if err := os.Setenv("API_HOST", *apiHost); err != nil {
			panic(err)
		}
	}
	if apiPort != nil {
		if err := os.Setenv("API_PORT", *apiPort); err != nil {
			panic(err)
		}
	}
	ctx := gaeint.BackgroundContext()
	err := dtog.StartSync(ctx, *bindingAddr) // should never return
	log.Fatalf("problem with d/g proxy %v", err)
}