當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Reader.GetString方法代碼示例

本文整理匯總了Golang中github.com/corestoreio/csfw/config.Reader.GetString方法的典型用法代碼示例。如果您正苦於以下問題:Golang Reader.GetString方法的具體用法?Golang Reader.GetString怎麽用?Golang Reader.GetString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/corestoreio/csfw/config.Reader的用法示例。


在下文中一共展示了Reader.GetString方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: BaseCurrencyCode

// BaseCurrencyCode retrieves application base currency code
func BaseCurrencyCode(cr config.Reader) (language.Currency, error) {
	base, err := cr.GetString(config.Path(PathCurrencyBase))
	if config.NotKeyNotFoundError(err) {
		return language.Currency{}, err
	}
	return language.ParseCurrency(base)
}
開發者ID:levcom,項目名稱:csfw,代碼行數:8,代碼來源:currency.go

示例2: WithPasswordFromConfig

// WithPasswordFromConfig retrieves the password from the configuration with path
// as defined in constant PathJWTPassword
func WithPasswordFromConfig(cr config.Reader) Option {
	pw, err := cr.GetString(config.Path(PathJWTPassword))
	if config.NotKeyNotFoundError(err) {
		pw = string(uuid.NewRandom())
	}
	return WithPassword([]byte(pw))
}
開發者ID:levcom,項目名稱:csfw,代碼行數:9,代碼來源:options.go

示例3: AllowedCurrencies

// AllowedCurrencies returns all installed currencies from global scope.
func AllowedCurrencies(cr config.Reader) ([]string, error) {
	installedCur, err := cr.GetString(config.Path(PathSystemCurrencyInstalled))
	if config.NotKeyNotFoundError(err) {
		return nil, err
	}
	// TODO use internal model of PathSystemCurrencyInstalled defined in package directory
	return strings.Split(installedCur, ","), nil
}
開發者ID:levcom,項目名稱:csfw,代碼行數:9,代碼來源:currency.go

示例4: IsSecure

// IsSecure checks if a request has been sent over a TLS connection. Also checks
// if the app runs behind a proxy server and therefore checks the off loader header.
func IsSecure(cr config.Reader, r *http.Request) bool {
	// due to import cycle this function must be in this package
	if r.TLS != nil {
		return true
	}

	oh, err := cr.GetString(config.Path(PathOffloaderHeader), config.ScopeDefault())
	if err != nil {
		if PkgLog.IsDebug() {
			PkgLog.Debug("net.httputils.IsSecure.FromContextReader.GetString", "err", err, "path", PathOffloaderHeader)
		}
		return false
	}

	h := r.Header.Get(oh)
	hh := r.Header.Get("HTTP_" + oh)

	var isHTTPS bool
	switch "https" {
	case h, hh:
		isHTTPS = true
	}
	return isHTTPS
}
開發者ID:levcom,項目名稱:csfw,代碼行數:26,代碼來源:inspections.go

示例5: BaseCurrencyCode

// BaseCurrencyCode retrieves application base currency code
func BaseCurrencyCode(cr config.Reader) (language.Currency, error) {
	return language.ParseCurrency(cr.GetString(config.Path(PathCurrencyBase)))
}
開發者ID:hafeez3000,項目名稱:csfw,代碼行數:4,代碼來源:currency.go

示例6: DefaultCountry

// DefaultCountry returns the country code. Store argument is optional.
func DefaultCountry(cr config.Reader, r config.ScopeIDer) string {
	return cr.GetString(config.Path(PathDefaultCountry), config.ScopeStore(r))
}
開發者ID:bom-d-van,項目名稱:csfw,代碼行數:4,代碼來源:country.go

示例7: SetPasswordFromConfig

// SetPasswordFromConfig retrieves the password from the configuration with path
// as defined in constant PathJWTPassword
func SetPasswordFromConfig(cr config.Reader) OptionFunc {
	pw := cr.GetString(config.Path(PathJWTPassword))
	return SetPassword([]byte(pw))
}
開發者ID:hafeez3000,項目名稱:csfw,代碼行數:6,代碼來源:options.go


注:本文中的github.com/corestoreio/csfw/config.Reader.GetString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。