Commit c35f737c authored by Matija Obreza's avatar Matija Obreza
Browse files

Skip contents check on startup if auto.createContent=false

parent 4fc84353
...@@ -21,6 +21,7 @@ import org.genesys2.server.service.GeoService; ...@@ -21,6 +21,7 @@ import org.genesys2.server.service.GeoService;
import org.genesys2.server.service.InstituteService; import org.genesys2.server.service.InstituteService;
import org.genesys2.server.service.worker.InstituteUpdater; import org.genesys2.server.service.worker.InstituteUpdater;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -32,6 +33,9 @@ import org.springframework.stereotype.Component; ...@@ -32,6 +33,9 @@ import org.springframework.stereotype.Component;
@Component @Component
public class FirstRunListener extends RunAsAdminListener { public class FirstRunListener extends RunAsAdminListener {
@Value("${auto.createContent}")
private boolean createContent = false;
@Autowired @Autowired
GeoService geoService; GeoService geoService;
...@@ -43,7 +47,11 @@ public class FirstRunListener extends RunAsAdminListener { ...@@ -43,7 +47,11 @@ public class FirstRunListener extends RunAsAdminListener {
@Override @Override
protected void init() throws Exception { protected void init() throws Exception {
if (!createContent) {
_logger.info("Skipping content creation on startup.");
return;
}
if (geoService.listAll().size() == 0) { if (geoService.listAll().size() == 0) {
_logger.info("No country data found. Loading"); _logger.info("No country data found. Loading");
geoService.updateCountryData(); geoService.updateCountryData();
......
...@@ -51,3 +51,8 @@ google.analytics.account= ...@@ -51,3 +51,8 @@ google.analytics.account=
# CDN # CDN
cdn.base=http://cdn.sandbox.genesys-pgr.org cdn.base=http://cdn.sandbox.genesys-pgr.org
cdn.flags.url=${cdn.base}/flags cdn.flags.url=${cdn.base}/flags
# Content creation on startup
auto.createContent=true
...@@ -41,3 +41,6 @@ google.analytics.account= ...@@ -41,3 +41,6 @@ google.analytics.account=
# CDN # CDN
cdn.base=http://cdn.sandbox.genesys-pgr.org cdn.base=http://cdn.sandbox.genesys-pgr.org
cdn.flags.url=${cdn.base}/flags cdn.flags.url=${cdn.base}/flags
# Content creation on startup
auto.createContent=false
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment