Esempio n. 1
0
func getImage(bsConf *provision.ScopedConfig) string {
	image := bsConf.GetExtraString("image")
	if image != "" {
		return image
	}
	image, _ = config.GetString("docker:bs:image")
	if image == "" {
		image = bsDefaultImageName
	}
	return image
}
Esempio n. 2
0
func getToken(bsConf *provision.ScopedConfig) (string, error) {
	token := bsConf.GetExtraString("token")
	if token != "" {
		return token, nil
	}
	tokenData, err := app.AuthScheme.AppLogin(app.InternalAppName)
	if err != nil {
		return "", err
	}
	token = tokenData.GetValue()
	isSet, err := bsConf.SetExtraAtomic("token", token)
	if isSet {
		return token, nil
	}
	app.AuthScheme.Logout(token)
	if err != nil {
		return "", err
	}
	token = bsConf.GetExtraString("token")
	if token == "" {
		return "", fmt.Errorf("invalid empty bs api token")
	}
	return token, nil
}