本文整理汇总了Golang中github.com/corestoreio/csfw/config.Reader类的典型用法代码示例。如果您正苦于以下问题:Golang Reader类的具体用法?Golang Reader怎么用?Golang Reader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Reader类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: Authenticate
func (u *User) Authenticate(cr config.Reader, h crypto.Hasher, username, password string) error {
isCaseSensitive := cr.GetBool(config.Path("admin/security/use_case_sensitive_login"))
if !isCaseSensitive {
// ... hmm
}
return nil
}
开发者ID:hafeez3000,项目名称:csfw,代码行数:9,代码来源:user.go
示例5: 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
示例6: 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
示例7: ShowNonRequiredState
// ShowNonRequiredState
func ShowNonRequiredState(cr config.Reader, r scope.StoreIDer) bool {
return cr.GetBool(config.ScopeStore(r.StoreID()), config.Path(PathDisplayAllStates))
}
开发者ID:hafeez3000,项目名称:csfw,代码行数:4,代码来源:region.go
示例8: 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
示例9: 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类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论