All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.capitalone.dashboard.collector.GitHubSettings Maven / Gradle / Ivy

package com.capitalone.dashboard.collector;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Bean to hold settings specific to the UDeploy collector.
 */
@Component
@ConfigurationProperties(prefix = "github")
public class GitHubSettings {
	private String cron;
    private String graphqlUrl;
    private String baseApiUrl;
	private String key;
	@Value("${github.firstRunHistoryDays:14}")
	private int firstRunHistoryDays;
	private List notBuiltCommits;
	@Value("${github.errorThreshold:2}")
	private int errorThreshold;
	@Value("${github.errorResetWindow:3600000}")
	private int errorResetWindow;  // default reset window = 1 hour
	@Value("${github.waitTime:300}")
	private int waitTime;
	@Value("${github.rateLimitThreshold:10}")
	private int rateLimitThreshold;
	// GitHub Enterprise does not have ratelimit
	// set to false to skip this check
	@Value("${github.checkRateLimit:true}")
	private boolean checkRateLimit;
	@Value("${github.commitPullSyncTime:86400000}") // 1 day in milliseconds
	private long commitPullSyncTime;
	@Value("${github.offsetMinutes:10}") // 10 mins default
	private int offsetMinutes;

	@Value("${github.offsetMinutes:120}") // 120 mins default
	private int privateRepoOffsetMinutes;

	@Value("${github.fetchCount:50}")
	private int fetchCount;

	private String searchCriteria;

	private String personalAccessToken;

	@Value("${github.connectTimeout:20000}")
	private int connectTimeout;

	@Value("${github.readTimeout:20000}")
	private int readTimeout;

	private String proxyUrl;

	private String proxyPort;

	private String proxyUser;

	private String proxyPassword;

	@Value("${github.privateRepoCollectionTime:600000}")
	private long privateRepoCollectionTime; //private repos will be collected in these many milliseconds.

    @Value("${github.collectChangedReposOnly:true}")
    private boolean collectChangedReposOnly;

	@Value("${github.optimizeUserCallsToGithub:true}")
    private boolean optimizeUserCallsToGithub;

	@Value("${github.maxRetries:5}")
    private int maxRetries;

	@Value("${github.delay:250}")
	private long delay;


	public String getCron() {
		return cron;
	}

	public void setCron(String cron) {
		this.cron = cron;
	}

	public String getKey() {
		return key;
	}

	public void setKey(String key) {
		this.key = key;
	}

	public int getFirstRunHistoryDays() {
		return firstRunHistoryDays;
	}

	public void setFirstRunHistoryDays(int firstRunHistoryDays) {
		this.firstRunHistoryDays = firstRunHistoryDays;
	}

	public List getNotBuiltCommits() {
		return notBuiltCommits;
	}

	public void setNotBuiltCommits(List notBuiltCommits) {
		this.notBuiltCommits = notBuiltCommits;
	}

	public int getErrorThreshold() {
		return errorThreshold;
	}

	public int getWaitTime() { return waitTime; }

	public void setWaitTime(int waitTime) { this.waitTime = waitTime; }

	public void setErrorThreshold(int errorThreshold) {
		this.errorThreshold = errorThreshold;
	}

	public int getRateLimitThreshold() {
		return rateLimitThreshold;
	}

	public void setRateLimitThreshold(int rateLimitThreshold) {
		this.rateLimitThreshold = rateLimitThreshold;
	}

	public boolean isCheckRateLimit() {
		return checkRateLimit;
	}

	public void setCheckRateLimit(boolean checkRateLimit) {
		this.checkRateLimit = checkRateLimit;
	}

	public String getPersonalAccessToken() {
		return personalAccessToken;
	}

	public void setPersonalAccessToken(String personalAccessToken) {
		this.personalAccessToken = personalAccessToken;
	}

	public int getErrorResetWindow() {
		return errorResetWindow;
	}

	public void setErrorResetWindow(int errorResetWindow) {
		this.errorResetWindow = errorResetWindow;
	}

	public long getCommitPullSyncTime() {
		return commitPullSyncTime;
	}

	public void setCommitPullSyncTime(long commitPullSyncTime) {
		this.commitPullSyncTime = commitPullSyncTime;
	}

	public int getOffsetMinutes() { return offsetMinutes; }

	public void setOffsetMinutes(int offsetMinutes) {
		this.offsetMinutes = offsetMinutes;
	}

	public int getPrivateRepoOffsetMinutes() { return privateRepoOffsetMinutes; }

	public void setPrivateRepoOffsetMinutes(int privateRepoOffsetMinutes) { this.privateRepoOffsetMinutes = privateRepoOffsetMinutes; }

	public int getFetchCount() {
		return fetchCount;
	}

	public void setFetchCount(int fetchCount) {
		this.fetchCount = fetchCount;
	}

	public int getReadTimeout() { return readTimeout; }

	public void setReadTimeout(int readTimeout) { this.readTimeout = readTimeout; }

	public int getConnectTimeout() { return connectTimeout; }

	public void setConnectTimeout(int connectTimeout) { this.connectTimeout = connectTimeout; }

	public String getProxyUrl() { return proxyUrl; }

	public void setProxyUrl(String proxyUrl) { this.proxyUrl = proxyUrl; }

	public String getProxyPort() { return proxyPort; }

	public void setProxyPort(String proxyPort) { this.proxyPort = proxyPort; }

	public String getProxyUser() { return proxyUser; }

	public void setProxyUser(String proxyUser) { this.proxyUser = proxyUser; }

	public String getProxyPassword() { return proxyPassword; }

	public void setProxyPassword(String proxyPassword) { this.proxyPassword = proxyPassword; }

	public String getGraphqlUrl() { return graphqlUrl; }

	public void setGraphqlUrl(String graphqlUrl) { this.graphqlUrl = graphqlUrl; }

	public String getBaseApiUrl() { return baseApiUrl; }

	public void setBaseApiUrl(String baseApiUrl) { this.baseApiUrl = baseApiUrl; }

	public String getSearchCriteria() {
		return searchCriteria;
	}

	public void setSearchCriteria(String searchCriteria) {
		this.searchCriteria = searchCriteria;
	}

	public long getPrivateRepoCollectionTime() {
		return privateRepoCollectionTime;
	}

	public void setPrivateRepoCollectionTime(long privateRepoCollectionTime) {
		this.privateRepoCollectionTime = privateRepoCollectionTime;
	}

    public boolean isCollectChangedReposOnly() {
        return collectChangedReposOnly;
    }

    public void setCollectChangedReposOnly(boolean collectChangedReposOnly) {
        this.collectChangedReposOnly = collectChangedReposOnly;
    }

	public boolean isOptimizeUserCallsToGithub() {
		return optimizeUserCallsToGithub;
	}

	public void setOptimizeUserCallsToGithub(boolean optimizeUserCallsToGithub) {
		this.optimizeUserCallsToGithub = optimizeUserCallsToGithub;
	}

	public int getMaxRetries() {
		return maxRetries;
	}

	public void setMaxRetries(int maxRetries) {
		this.maxRetries = maxRetries;
	}

	public long getDelay() {
		return delay;
	}

	public void setDelay(long delay) {
		this.delay = delay;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy