#83 add tasks, modify build script for passing application properties
This commit is contained in:
parent
fe1820d540
commit
c7cdbe9044
@ -27,6 +27,26 @@ build:
|
||||
- build
|
||||
- .gradle
|
||||
|
||||
checkRun:
|
||||
stage: test
|
||||
script: ./gradlew bootRun -Dng-tracker.check-run=true
|
||||
cache:
|
||||
key: "$CI_PROJECT_ID"
|
||||
policy: push
|
||||
paths:
|
||||
- build
|
||||
- .gradle
|
||||
|
||||
checkStyle:
|
||||
stage: test
|
||||
script: ./gradlew check
|
||||
cache:
|
||||
key: "$CI_PROJECT_ID"
|
||||
policy: push
|
||||
paths:
|
||||
- build
|
||||
- .gradle
|
||||
|
||||
deploy:
|
||||
stage: deploy
|
||||
script:
|
||||
|
@ -30,6 +30,10 @@ bootRun.dependsOn checkstyleMain
|
||||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
|
||||
bootRun {
|
||||
systemProperties = System.properties
|
||||
}
|
||||
|
||||
checkstyle {
|
||||
|
||||
project.ext.checkstyleVersion = '8.8'
|
||||
|
@ -2,13 +2,30 @@ package ru.ulstu;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||
import ru.ulstu.configuration.ApplicationProperties;
|
||||
import ru.ulstu.core.repository.JpaDetachableRepositoryImpl;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableJpaRepositories(repositoryBaseClass = JpaDetachableRepositoryImpl.class)
|
||||
public class NgTrackerApplication {
|
||||
private final ApplicationProperties applicationProperties;
|
||||
|
||||
public NgTrackerApplication(ApplicationProperties applicationProperties) {
|
||||
this.applicationProperties = applicationProperties;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(NgTrackerApplication.class, args);
|
||||
}
|
||||
|
||||
@EventListener(ApplicationReadyEvent.class)
|
||||
public void doSomethingAfterStartup() {
|
||||
System.out.println("hello world, I have just started up");
|
||||
if (applicationProperties.isCheckRun()) {
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,12 +11,16 @@ import org.springframework.validation.annotation.Validated;
|
||||
public class ApplicationProperties {
|
||||
@NotBlank
|
||||
private String baseUrl;
|
||||
|
||||
@NotBlank
|
||||
private String undeadUserLogin;
|
||||
|
||||
private boolean devMode;
|
||||
|
||||
private boolean useHttps;
|
||||
|
||||
private boolean checkRun;
|
||||
|
||||
public boolean isUseHttps() {
|
||||
return useHttps;
|
||||
}
|
||||
@ -48,4 +52,12 @@ public class ApplicationProperties {
|
||||
public void setDevMode(boolean devMode) {
|
||||
this.devMode = devMode;
|
||||
}
|
||||
|
||||
public boolean isCheckRun() {
|
||||
return checkRun;
|
||||
}
|
||||
|
||||
public void setCheckRun(boolean checkRun) {
|
||||
this.checkRun = checkRun;
|
||||
}
|
||||
}
|
||||
|
@ -36,3 +36,4 @@ ng-tracker.base-url=http://127.0.0.1:8080
|
||||
ng-tracker.undead-user-login=admin
|
||||
ng-tracker.dev-mode=true
|
||||
ng-tracker.use-https=false
|
||||
ng-tracker.check-run=false
|
Loading…
Reference in New Issue
Block a user