func (pp *PkgBackend) init(cfgStruct element.SectionSlice) *PkgBackend { pp.Lock() defer pp.Unlock() pp.DevJsSessionStorageLogging = model.NewBool(`dev/js/session_storage_logging`, model.WithConfigStructure(cfgStruct)) pp.DevJsSessionStorageKey = model.NewStr(`dev/js/session_storage_key`, model.WithConfigStructure(cfgStruct)) return pp }
func (pp *PkgBackend) init(cfgStruct element.SectionSlice) *PkgBackend { pp.Lock() defer pp.Unlock() pp.SalesGiftOptionsAllowOrder = model.NewBool(`sales/gift_options/allow_order`, model.WithConfigStructure(cfgStruct)) pp.SalesGiftOptionsAllowItems = model.NewBool(`sales/gift_options/allow_items`, model.WithConfigStructure(cfgStruct)) return pp }
func (pp *PkgBackend) init(cfgStruct element.SectionSlice) *PkgBackend { pp.Lock() defer pp.Unlock() pp.GoogleAnalyticsActive = model.NewBool(`google/analytics/active`, model.WithConfigStructure(cfgStruct)) pp.GoogleAnalyticsAccount = model.NewStr(`google/analytics/account`, model.WithConfigStructure(cfgStruct)) return pp }
func (pp *PkgBackend) init(cfgStruct element.SectionSlice) *PkgBackend { pp.Lock() defer pp.Unlock() pp.CatalogSearchEngine = model.NewStr(`catalog/search/engine`, model.WithConfigStructure(cfgStruct)) pp.CatalogSearchSearchType = model.NewStr(`catalog/search/search_type`, model.WithConfigStructure(cfgStruct)) return pp }
func (pp *PkgBackend) init(cfgStruct element.SectionSlice) *PkgBackend { pp.Lock() defer pp.Unlock() pp.ContactContactEnabled = model.NewBool(`contact/contact/enabled`, model.WithConfigStructure(cfgStruct)) pp.ContactEmailRecipientEmail = model.NewStr(`contact/email/recipient_email`, model.WithConfigStructure(cfgStruct)) pp.ContactEmailSenderEmailIdentity = model.NewStr(`contact/email/sender_email_identity`, model.WithConfigStructure(cfgStruct)) pp.ContactEmailEmailTemplate = model.NewStr(`contact/email/email_template`, model.WithConfigStructure(cfgStruct)) return pp }
func (pp *PkgBackend) init(cfgStruct element.SectionSlice) *PkgBackend { pp.Lock() defer pp.Unlock() pp.CatalogSeoCategoryUrlSuffix = model.NewStr(`catalog/seo/category_url_suffix`, model.WithConfigStructure(cfgStruct)) pp.CatalogSeoProductUrlSuffix = model.NewStr(`catalog/seo/product_url_suffix`, model.WithConfigStructure(cfgStruct)) pp.CatalogSeoProductUseCategories = model.NewBool(`catalog/seo/product_use_categories`, model.WithConfigStructure(cfgStruct)) pp.CatalogSeoSaveRewritesHistory = model.NewBool(`catalog/seo/save_rewrites_history`, model.WithConfigStructure(cfgStruct)) return pp }
func (pp *PkgBackend) init(cfgStruct element.SectionSlice) *PkgBackend { pp.Lock() defer pp.Unlock() pp.CatalogSeoSearchTerms = model.NewBool(`catalog/seo/search_terms`, model.WithConfigStructure(cfgStruct)) pp.CatalogSearchEngine = model.NewStr(`catalog/search/engine`, model.WithConfigStructure(cfgStruct)) pp.CatalogSearchMinQueryLength = model.NewStr(`catalog/search/min_query_length`, model.WithConfigStructure(cfgStruct)) pp.CatalogSearchMaxQueryLength = model.NewStr(`catalog/search/max_query_length`, model.WithConfigStructure(cfgStruct)) return pp }
func (pp *PkgBackend) init(cfgStruct element.SectionSlice) *PkgBackend { pp.Lock() defer pp.Unlock() pp.SalesMsrpEnabled = model.NewBool(`sales/msrp/enabled`, model.WithConfigStructure(cfgStruct)) pp.SalesMsrpDisplayPriceType = model.NewStr(`sales/msrp/display_price_type`, model.WithConfigStructure(cfgStruct)) pp.SalesMsrpExplanationMessage = model.NewStr(`sales/msrp/explanation_message`, model.WithConfigStructure(cfgStruct)) pp.SalesMsrpExplanationMessageWhatsThis = model.NewStr(`sales/msrp/explanation_message_whats_this`, model.WithConfigStructure(cfgStruct)) return pp }
func (pp *PkgBackend) init(cfgStruct element.SectionSlice) *PkgBackend { pp.Lock() defer pp.Unlock() pp.OauthCleanupCleanupProbability = model.NewStr(`oauth/cleanup/cleanup_probability`, model.WithConfigStructure(cfgStruct)) pp.OauthCleanupExpirationPeriod = model.NewStr(`oauth/cleanup/expiration_period`, model.WithConfigStructure(cfgStruct)) pp.OauthConsumerExpirationPeriod = model.NewStr(`oauth/consumer/expiration_period`, model.WithConfigStructure(cfgStruct)) pp.OauthConsumerPostMaxredirects = model.NewStr(`oauth/consumer/post_maxredirects`, model.WithConfigStructure(cfgStruct)) pp.OauthConsumerPostTimeout = model.NewStr(`oauth/consumer/post_timeout`, model.WithConfigStructure(cfgStruct)) return pp }
func (pp *PkgBackend) init(cfgStruct element.SectionSlice) *PkgBackend { pp.Lock() defer pp.Unlock() pp.SystemBackupEnabled = model.NewBool(`system/backup/enabled`, model.WithConfigStructure(cfgStruct)) pp.SystemBackupType = model.NewStr(`system/backup/type`, model.WithConfigStructure(cfgStruct)) pp.SystemBackupTime = model.NewStr(`system/backup/time`, model.WithConfigStructure(cfgStruct)) pp.SystemBackupFrequency = model.NewStr(`system/backup/frequency`, model.WithConfigStructure(cfgStruct)) pp.SystemBackupMaintenance = model.NewBool(`system/backup/maintenance`, model.WithConfigStructure(cfgStruct)) return pp }
func (pp *PkgBackend) init(cfgStruct element.SectionSlice) *PkgBackend { pp.Lock() defer pp.Unlock() pp.CatalogRecentlyProductsScope = model.NewStr(`catalog/recently_products/scope`, model.WithConfigStructure(cfgStruct)) pp.CatalogRecentlyProductsViewedCount = model.NewStr(`catalog/recently_products/viewed_count`, model.WithConfigStructure(cfgStruct)) pp.CatalogRecentlyProductsComparedCount = model.NewStr(`catalog/recently_products/compared_count`, model.WithConfigStructure(cfgStruct)) pp.ReportsDashboardYtdStart = model.NewStr(`reports/dashboard/ytd_start`, model.WithConfigStructure(cfgStruct)) pp.ReportsDashboardMtdStart = model.NewStr(`reports/dashboard/mtd_start`, model.WithConfigStructure(cfgStruct)) return pp }
func (pp *PkgBackend) init(cfgStruct element.SectionSlice) *PkgBackend { pp.Lock() defer pp.Unlock() pp.WebCookieCookieLifetime = model.NewStr(`web/cookie/cookie_lifetime`, model.WithConfigStructure(cfgStruct)) pp.WebCookieCookiePath = model.NewStr(`web/cookie/cookie_path`, model.WithConfigStructure(cfgStruct)) pp.WebCookieCookieDomain = model.NewStr(`web/cookie/cookie_domain`, model.WithConfigStructure(cfgStruct)) pp.WebCookieCookieHttponly = model.NewBool(`web/cookie/cookie_httponly`, model.WithConfigStructure(cfgStruct)) pp.WebCookieCookieRestriction = model.NewBool(`web/cookie/cookie_restriction`, model.WithConfigStructure(cfgStruct)) return pp }
func (pp *PkgBackend) init(cfgStruct element.SectionSlice) *PkgBackend { pp.Lock() defer pp.Unlock() pp.PersistentOptionsEnabled = model.NewBool(`persistent/options/enabled`, model.WithConfigStructure(cfgStruct)) pp.PersistentOptionsLifetime = model.NewStr(`persistent/options/lifetime`, model.WithConfigStructure(cfgStruct)) pp.PersistentOptionsRememberEnabled = model.NewBool(`persistent/options/remember_enabled`, model.WithConfigStructure(cfgStruct)) pp.PersistentOptionsRememberDefault = model.NewBool(`persistent/options/remember_default`, model.WithConfigStructure(cfgStruct)) pp.PersistentOptionsLogoutClear = model.NewBool(`persistent/options/logout_clear`, model.WithConfigStructure(cfgStruct)) pp.PersistentOptionsShoppingCart = model.NewBool(`persistent/options/shopping_cart`, model.WithConfigStructure(cfgStruct)) return pp }
func (pp *PkgBackend) init(cfgStruct element.SectionSlice) *PkgBackend { pp.Lock() defer pp.Unlock() pp.CatalogDownloadableOrderItemStatus = model.NewStr(`catalog/downloadable/order_item_status`, model.WithConfigStructure(cfgStruct)) pp.CatalogDownloadableDownloadsNumber = model.NewStr(`catalog/downloadable/downloads_number`, model.WithConfigStructure(cfgStruct)) pp.CatalogDownloadableShareable = model.NewBool(`catalog/downloadable/shareable`, model.WithConfigStructure(cfgStruct)) pp.CatalogDownloadableSamplesTitle = model.NewStr(`catalog/downloadable/samples_title`, model.WithConfigStructure(cfgStruct)) pp.CatalogDownloadableLinksTitle = model.NewStr(`catalog/downloadable/links_title`, model.WithConfigStructure(cfgStruct)) pp.CatalogDownloadableLinksTargetNewWindow = model.NewBool(`catalog/downloadable/links_target_new_window`, model.WithConfigStructure(cfgStruct)) pp.CatalogDownloadableContentDisposition = model.NewStr(`catalog/downloadable/content_disposition`, model.WithConfigStructure(cfgStruct)) pp.CatalogDownloadableDisableGuestCheckout = model.NewBool(`catalog/downloadable/disable_guest_checkout`, model.WithConfigStructure(cfgStruct)) return pp }
func (pp *PkgBackend) init(cfgStruct element.SectionSlice) *PkgBackend { pp.Lock() defer pp.Unlock() pp.NewrelicreportingGeneralEnable = model.NewBool(`newrelicreporting/general/enable`, model.WithConfigStructure(cfgStruct)) pp.NewrelicreportingGeneralApiUrl = model.NewStr(`newrelicreporting/general/api_url`, model.WithConfigStructure(cfgStruct)) pp.NewrelicreportingGeneralInsightsApiUrl = model.NewStr(`newrelicreporting/general/insights_api_url`, model.WithConfigStructure(cfgStruct)) pp.NewrelicreportingGeneralAccountId = model.NewStr(`newrelicreporting/general/account_id`, model.WithConfigStructure(cfgStruct)) pp.NewrelicreportingGeneralAppId = model.NewStr(`newrelicreporting/general/app_id`, model.WithConfigStructure(cfgStruct)) pp.NewrelicreportingGeneralApi = model.NewStr(`newrelicreporting/general/api`, model.WithConfigStructure(cfgStruct)) pp.NewrelicreportingGeneralInsightsInsertKey = model.NewStr(`newrelicreporting/general/insights_insert_key`, model.WithConfigStructure(cfgStruct)) pp.NewrelicreportingGeneralAppName = model.NewStr(`newrelicreporting/general/app_name`, model.WithConfigStructure(cfgStruct)) pp.NewrelicreportingCronEnableCron = model.NewBool(`newrelicreporting/cron/enable_cron`, model.WithConfigStructure(cfgStruct)) return pp }
func (pp *PkgBackend) init(cfgStruct element.SectionSlice) *PkgBackend { pp.Lock() defer pp.Unlock() pp.WebapiSoapCharset = model.NewStr(`webapi/soap/charset`, model.WithConfigStructure(cfgStruct)) return pp }
func (pp *PkgBackend) init(cfgStruct element.SectionSlice) *PkgBackend { pp.Lock() defer pp.Unlock() pp.RssConfigActive = model.NewBool(`rss/config/active`, model.WithConfigStructure(cfgStruct)) return pp }
func (pp *PkgBackend) init(cfgStruct element.SectionSlice) *PkgBackend { pp.Lock() defer pp.Unlock() pp.DevJsTranslateStrategy = model.NewStr(`dev/js/translate_strategy`, model.WithConfigStructure(cfgStruct)) return pp }
func (pp *PkgBackend) init(cfgStruct element.SectionSlice) *PkgBackend { pp.Lock() defer pp.Unlock() pp.CatalogReviewAllowGuest = model.NewBool(`catalog/review/allow_guest`, model.WithConfigStructure(cfgStruct)) return pp }
func TestStringCSV(t *testing.T) { t.Parallel() wantPath := scope.StrDefault.FQPathInt64(0, "web/cors/exposed_headers") b := model.NewStringCSV( "web/cors/exposed_headers", model.WithConfigStructure(configStructure), model.WithSourceByString( "Content-Type", "Content Type", "X-CoreStore-ID", "CoreStore Microservice ID", ), ) assert.NotEmpty(t, b.Options()) assert.Exactly(t, []string{"Content-Type", "X-CoreStore-ID"}, b.Get(config.NewMockGetter().NewScoped(0, 0, 0))) assert.Exactly(t, []string{"Content-Application", "X-Gopher"}, b.Get(config.NewMockGetter( config.WithMockValues(config.MockPV{ wantPath: "Content-Application,X-Gopher", }), ).NewScoped(0, 0, 0))) mw := &config.MockWrite{} b.Source.Merge(source.NewByString("a", "a", "b", "b", "c", "c")) assert.NoError(t, b.Write(mw, []string{"a", "b", "c"}, scope.DefaultID, 0)) assert.Exactly(t, wantPath, mw.ArgPath) assert.Exactly(t, "a,b,c", mw.ArgValue.(string)) }
func (pp *PkgBackend) init(cfgStruct element.SectionSlice) *PkgBackend { pp.Lock() defer pp.Unlock() pp.GoogleAnalyticsExperiments = model.NewBool(`google/analytics/experiments`, model.WithConfigStructure(cfgStruct)) return pp }
func TestConfigRedirectToBase(t *testing.T) { defer debugLogBuf.Reset() t.Parallel() r := backend.NewConfigRedirectToBase( backend.Backend.WebURLRedirectToBase.String(), model.WithConfigStructure(backend.ConfigStructure), ) cr := config.NewMockGetter( config.WithMockValues(config.MockPV{ backend.Backend.WebURLRedirectToBase.FQPathInt64(scope.StrDefault, 0): 2, }), ) code := r.Get(cr.NewScoped(0, 0, 0)) assert.Exactly(t, 2, code) code = r.Get(cr.NewScoped(1, 1, 2)) assert.Exactly(t, 0, code) // that is crap we should return an error assert.Contains(t, debugLogBuf.String(), "Scope permission insufficient: Have 'Store'; Want 'Default'") mw := new(config.MockWrite) assert.EqualError(t, r.Write(mw, 200, scope.DefaultID, 0), "Cannot find 200 in list: [{\"Value\":0,\"Label\":\"No\"},{\"Value\":1,\"Label\":\"Yes (302 Found)\"},{\"Value\":302,\"Label\":\"Yes (302 Found)\"},{\"Value\":301,\"Label\":\"Yes (301 Moved Permanently)\"}]\n", ) // 200 not allowed }
func (pp *PkgBackend) init(cfgStruct element.SectionSlice) *PkgBackend { pp.Lock() defer pp.Unlock() pp.PaymentVaultVaultPayment = model.NewStr(`payment/vault/vault_payment`, model.WithConfigStructure(cfgStruct)) return pp }
func (pp *PkgBackend) init(cfgStruct element.SectionSlice) *PkgBackend { pp.Lock() defer pp.Unlock() pp.DevFrontEndDevelopmentWorkflowType = model.NewStr(`dev/front_end_development_workflow/type`, model.WithConfigStructure(cfgStruct)) pp.DevRestrictAllowIps = model.NewStr(`dev/restrict/allow_ips`, model.WithConfigStructure(cfgStruct)) return pp }
func (pp *PkgBackend) init(cfgStruct element.SectionSlice) *PkgBackend { pp.Lock() defer pp.Unlock() pp.SystemFullPageCacheCachingApplication = model.NewStr(`system/full_page_cache/caching_application`, model.WithConfigStructure(cfgStruct)) pp.SystemFullPageCacheTtl = model.NewStr(`system/full_page_cache/ttl`, model.WithConfigStructure(cfgStruct)) return pp }
func (pp *PkgBackend) init(cfgStruct element.SectionSlice) *PkgBackend { pp.Lock() defer pp.Unlock() pp.CheckoutOptionsOnepageCheckoutEnabled = model.NewBool(`checkout/options/onepage_checkout_enabled`, model.WithConfigStructure(cfgStruct)) pp.CheckoutOptionsGuestCheckout = model.NewBool(`checkout/options/guest_checkout`, model.WithConfigStructure(cfgStruct)) pp.CheckoutCartDeleteQuoteAfter = model.NewStr(`checkout/cart/delete_quote_after`, model.WithConfigStructure(cfgStruct)) pp.CheckoutCartRedirectToCart = model.NewBool(`checkout/cart/redirect_to_cart`, model.WithConfigStructure(cfgStruct)) pp.CheckoutCartLinkUseQty = model.NewStr(`checkout/cart_link/use_qty`, model.WithConfigStructure(cfgStruct)) pp.CheckoutSidebarDisplay = model.NewBool(`checkout/sidebar/display`, model.WithConfigStructure(cfgStruct)) pp.CheckoutSidebarCount = model.NewStr(`checkout/sidebar/count`, model.WithConfigStructure(cfgStruct)) pp.CheckoutPaymentFailedIdentity = model.NewStr(`checkout/payment_failed/identity`, model.WithConfigStructure(cfgStruct)) pp.CheckoutPaymentFailedReceiver = model.NewStr(`checkout/payment_failed/receiver`, model.WithConfigStructure(cfgStruct)) pp.CheckoutPaymentFailedTemplate = model.NewStr(`checkout/payment_failed/template`, model.WithConfigStructure(cfgStruct)) pp.CheckoutPaymentFailedCopyTo = model.NewStr(`checkout/payment_failed/copy_to`, model.WithConfigStructure(cfgStruct)) pp.CheckoutPaymentFailedCopyMethod = model.NewStr(`checkout/payment_failed/copy_method`, model.WithConfigStructure(cfgStruct)) return pp }
func (pp *PkgBackend) init(cfgStruct element.SectionSlice) *PkgBackend { pp.Lock() defer pp.Unlock() pp.PromoAutoGeneratedCouponCodesLength = model.NewStr(`promo/auto_generated_coupon_codes/length`, model.WithConfigStructure(cfgStruct)) pp.PromoAutoGeneratedCouponCodesFormat = model.NewStr(`promo/auto_generated_coupon_codes/format`, model.WithConfigStructure(cfgStruct)) pp.PromoAutoGeneratedCouponCodesPrefix = model.NewStr(`promo/auto_generated_coupon_codes/prefix`, model.WithConfigStructure(cfgStruct)) pp.PromoAutoGeneratedCouponCodesSuffix = model.NewStr(`promo/auto_generated_coupon_codes/suffix`, model.WithConfigStructure(cfgStruct)) pp.PromoAutoGeneratedCouponCodesDash = model.NewStr(`promo/auto_generated_coupon_codes/dash`, model.WithConfigStructure(cfgStruct)) pp.RssCatalogDiscounts = model.NewBool(`rss/catalog/discounts`, model.WithConfigStructure(cfgStruct)) return pp }
func (pp *PkgBackend) init(cfgStruct element.SectionSlice) *PkgBackend { pp.Lock() defer pp.Unlock() pp.TaxWeeeEnable = model.NewBool(`tax/weee/enable`, model.WithConfigStructure(cfgStruct)) pp.TaxWeeeDisplayList = model.NewStr(`tax/weee/display_list`, model.WithConfigStructure(cfgStruct)) pp.TaxWeeeDisplay = model.NewStr(`tax/weee/display`, model.WithConfigStructure(cfgStruct)) pp.TaxWeeeDisplaySales = model.NewStr(`tax/weee/display_sales`, model.WithConfigStructure(cfgStruct)) pp.TaxWeeeDisplayEmail = model.NewStr(`tax/weee/display_email`, model.WithConfigStructure(cfgStruct)) pp.TaxWeeeApplyVat = model.NewBool(`tax/weee/apply_vat`, model.WithConfigStructure(cfgStruct)) pp.TaxWeeeIncludeInSubtotal = model.NewBool(`tax/weee/include_in_subtotal`, model.WithConfigStructure(cfgStruct)) pp.SalesTotalsSortWeee = model.NewStr(`sales/totals_sort/weee`, model.WithConfigStructure(cfgStruct)) return pp }
func (pp *PkgBackend) init(cfgStruct element.SectionSlice) *PkgBackend { pp.Lock() defer pp.Unlock() pp.NewsletterSubscriptionAllowGuestSubscribe = model.NewBool(`newsletter/subscription/allow_guest_subscribe`, model.WithConfigStructure(cfgStruct)) pp.NewsletterSubscriptionConfirm = model.NewBool(`newsletter/subscription/confirm`, model.WithConfigStructure(cfgStruct)) pp.NewsletterSubscriptionConfirmEmailIdentity = model.NewStr(`newsletter/subscription/confirm_email_identity`, model.WithConfigStructure(cfgStruct)) pp.NewsletterSubscriptionConfirmEmailTemplate = model.NewStr(`newsletter/subscription/confirm_email_template`, model.WithConfigStructure(cfgStruct)) pp.NewsletterSubscriptionSuccessEmailIdentity = model.NewStr(`newsletter/subscription/success_email_identity`, model.WithConfigStructure(cfgStruct)) pp.NewsletterSubscriptionSuccessEmailTemplate = model.NewStr(`newsletter/subscription/success_email_template`, model.WithConfigStructure(cfgStruct)) pp.NewsletterSubscriptionUnEmailIdentity = model.NewStr(`newsletter/subscription/un_email_identity`, model.WithConfigStructure(cfgStruct)) pp.NewsletterSubscriptionUnEmailTemplate = model.NewStr(`newsletter/subscription/un_email_template`, model.WithConfigStructure(cfgStruct)) return pp }
func (pp *PkgBackend) init(cfgStruct element.SectionSlice) *PkgBackend { pp.Lock() defer pp.Unlock() pp.WishlistEmailEmailIdentity = model.NewStr(`wishlist/email/email_identity`, model.WithConfigStructure(cfgStruct)) pp.WishlistEmailEmailTemplate = model.NewStr(`wishlist/email/email_template`, model.WithConfigStructure(cfgStruct)) pp.WishlistEmailNumberLimit = model.NewStr(`wishlist/email/number_limit`, model.WithConfigStructure(cfgStruct)) pp.WishlistEmailTextLimit = model.NewStr(`wishlist/email/text_limit`, model.WithConfigStructure(cfgStruct)) pp.WishlistGeneralActive = model.NewBool(`wishlist/general/active`, model.WithConfigStructure(cfgStruct)) pp.WishlistWishlistLinkUseQty = model.NewStr(`wishlist/wishlist_link/use_qty`, model.WithConfigStructure(cfgStruct)) pp.RssWishlistActive = model.NewBool(`rss/wishlist/active`, model.WithConfigStructure(cfgStruct)) return pp }