use of com.microfocus.octane.gitlab.api.MergeRequestHistoryHandler in project octane-gitlab-service by MicroFocus.
the class Application method main.
public static void main(String[] args) throws GeneralSecurityException, IOException {
if (args.length > 0 && args[0].equals("encrypt")) {
if (args.length == 1) {
System.out.println("Usage: java -jar octane-gitlab-service-<version>.jar encrypt <password>");
return;
} else {
String tokenToEncrypt = args[1];
String encryptedToken = encrypt(tokenToEncrypt);
System.out.println("Encrypted token: " + PasswordEncryption.PREFIX + encryptedToken);
return;
}
}
ConfigurableApplicationContext context = SpringApplication.run(Application.class, args);
context.registerShutdownHook();
OctaneServices octaneServices = context.getBean("octaneServices", OctaneServices.class);
try {
if (octaneServices.getGitLabService().isCleanUpOnly()) {
System.out.println("clean-up webhooks from Gitlab server process is finished. Stopping the service");
context.close();
return;
}
tryToConnectToOctane(octaneServices);
OctaneSDK.addClient(octaneServices.getOctaneConfiguration(), OctaneServices.class);
MergeRequestHistoryHandler mrHistoryHandler = context.getBean(MergeRequestHistoryHandler.class);
mrHistoryHandler.executeFirstScan();
mrHistoryHandler.startListening();
System.out.println("Connection to Octane was successful. gitlab application is ready...");
} catch (IllegalArgumentException | OctaneConnectivityException r) {
log.warn("Connection to Octane failed: " + r.getMessage());
System.out.println("Connection to Octane failed: " + r.getMessage());
}
}
Aggregations