如何在不使用存储模块的情况下配置核心模块?

时间:2019-11-18 13:53:17

标签: spartacus-storefront

以下是我们当前的配置。我们如何不通过storeConfig来配置,后端,身份验证,上下文?

B2cStorefrontModule.withConfig(environment.storeConfig), ConfigModule.withConfigFactory(defaultCmsContentConfig),

storeConfig: {
    backend: {
      occ: {
        baseUrl: 'https://localhost:9002',
        prefix: '/mywebservices/v2/'
      }
    },
    authentication: {
      client_id: 'myid',
      client_secret: 'mysecret'
    },

    context: {
      baseSite: ['mysite'],
      currency: ['USD'],
    },

    i18n: {
      resources: translations,
      chunks: translationChunksConfig,
      fallbackLang: 'en'

    }

  },

1 个答案:

答案 0 :(得分:0)

您可以从provideConfig导入@spartacus/core并像这样使用它:

@NgModule({
  ...
  imports: [ 
  ...
  provideConfig({
    // your config goes here
    backend: {
      occ: {
        baseUrl: 'https://localhost:9002',
        prefix: '/mywebservices/v2/'
      }
    },
    authentication: {
      client_id: 'myid',
      client_secret: 'mysecret'
    },
  }),
  ]
  ...
})

您可以根据需要拥有任意数量的provideConfig()