add config parameter

This commit is contained in:
Anton Romanov 2018-11-08 20:08:26 +04:00
parent 1958e01d01
commit 4c43776528
6 changed files with 35 additions and 10 deletions

View File

@ -15,6 +15,16 @@ public class ApplicationProperties {
private String undeadUserLogin;
private boolean devMode;
private boolean useHttps;
public boolean isUseHttps() {
return useHttps;
}
public void setUseHttps(boolean useHttps) {
this.useHttps = useHttps;
}
public String getBaseUrl() {
return baseUrl;
}

View File

@ -86,13 +86,16 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
.deleteCookies(Constants.COOKIES_NAME)
.permitAll();
}
http.portMapper()
.http(httpPort)
.mapsTo(httpsPort)
.and()
.requiresChannel()
.anyRequest()
.requiresSecure();
if (applicationProperties.isUseHttps()) {
http.portMapper()
.http(httpPort)
.mapsTo(httpsPort)
.and()
.requiresChannel()
.anyRequest()
.requiresSecure();
}
}
@Override

View File

@ -18,8 +18,7 @@ public class StrategyEntityCreateExecutor {
}
//@Scheduled(cron = "0 0 8 * * *")
@Scheduled(cron = "0 */5 * * * *")
@Scheduled(cron = "0 0 8 * * *")
public void scheduleExecuteStrategies() {
entityCreateStrategies.forEach(strategy -> strategy.createEntityIfNeed(userService.findAll()));
}

View File

@ -34,4 +34,5 @@ liquibase.change-log=classpath:db/changelog-master.xml
# Application Settings
ng-tracker.base-url=https://127.0.0.1:8443
ng-tracker.undead-user-login=admin
ng-tracker.dev-mode=true
ng-tracker.dev-mode=true
ng-tracker.use-https=false

View File

@ -0,0 +1,11 @@
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
<changeSet author="orion" id="20181108_000000-1">
<sql>
update users
set email = 'romanov73@gmail.com' where id = 1;
</sql>
</changeSet>
</databaseChangeLog>

View File

@ -13,4 +13,5 @@
<include file="db/changelog-20180505_000000-schema.xml"/>
<include file="db/changelog-20181027_000000-schema.xml"/>
<include file="db/changelog-20181030_000000-schema.xml"/>
<include file="db/changelog-20181108_000000-data.xml"/>
</databaseChangeLog>