message: scaffolder: Fix backend fails to start
diff: @@ -55,11 +55,15 @@ export default async function createPlugin({
  const publishers = new Publishers();
  - const githubToken = config.getString('scaffolder.github.token');
  - const repoVisibility = config.getString(
  - 'scaffolder.github.visibility',
  + const githubConfig = config.getOptionalConfig('scaffolder.github');
  +
  + if (githubConfig) {
  + try {
  + const repoVisibility = githubConfig.getString(
  + 'visibility',
  ) as RepoVisilityOptions;
  + const githubToken = githubConfig.getString('token');
  const githubClient = new Octokit({ auth: githubToken });
  const githubPublisher = new GithubPublisher({
  client: githubClient,
  @@ -68,10 +72,23 @@ export default async function createPlugin({
  });
  publishers.register('file', githubPublisher);
  publishers.register('github', githubPublisher);
  + } catch (e) {
  + const providerName = 'github';
  + if (process.env.NODE_ENV !== 'development') {
  + throw new Error(
  + `Failed to initialize ${providerName} scaffolding provider, ${e.message}`,
  + );
  + }
  - const gitLabConfig = config.getOptionalConfig('scaffolder.gitlab.api');
  + logger.warn(
  + `Skipping ${providerName} scaffolding provider, ${e.message}`,
  + );
  + }
  + }
  + const gitLabConfig = config.getOptionalConfig('scaffolder.gitlab.api');
  if (gitLabConfig) {
  + try {
  const gitLabToken = gitLabConfig.getString('token');
  const gitLabClient = new Gitlab({
  host: gitLabConfig.getOptionalString('baseUrl'),
  @@ -80,6 +97,18 @@ export default async function createPlugin({
  const gitLabPublisher = new GitlabPublisher(gitLabClient, gitLabToken);
  publishers.register('gitlab', gitLabPublisher);
  publishers.register('gitlab/api', gitLabPublisher);
  + } catch (e) {
  + const providerName = 'gitlab';
  + if (process.env.NODE_ENV !== 'development') {
  + throw new Error(
  + `Failed to initialize ${providerName} scaffolding provider, ${e.message}`,
  + );
  + }
  +
  + logger.warn(
  + `Skipping ${providerName} scaffolding provider, ${e.message}`,
  + );
  + }
  }
  const dockerClient = new Docker();
  