private GitLabApi BuildGitLabApi(IComponentContext ctx) { var cfg = Configuration.GetSection("GitLab"); bool readOnly = false; if (!bool.TryParse(cfg["readOnly"] ?? "", out readOnly)) { readOnly = false; } return(GitLabApiFactory.CreateGitLabApi(cfg["url"], ctx.Resolve <IGitAccessTokenSource>(), cfg["Proxy"], ctx.Resolve <IMemoryCache>(), readOnly)); }
private static GitLabApi BuildGitLabApi(IConfiguration configuration) { var cfg = configuration.GetSection("GitLab"); var globalToken = cfg.GetValue <string>("globalToken"); var accessTokenSource = new CustomToken(globalToken); var memoryCache = new MemoryCache(new MemoryCacheOptions()); bool readOnly = false; if (!bool.TryParse(cfg["readOnly"] ?? "", out readOnly)) { readOnly = false; } return(GitLabApiFactory.CreateGitLabApi(cfg["url"], accessTokenSource, cfg["Proxy"], memoryCache, readOnly)); }