Skip to content

Commit

Permalink
Simplified configuration of repo
Browse files Browse the repository at this point in the history
  • Loading branch information
aedelmann committed Jan 15, 2017
1 parent 90fa9db commit 9d06b52
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@
*/
package org.eclipse.vorto.repository.web.config;

import org.modeshape.jcr.RepositoryConfiguration;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.core.io.ClassPathResource;

@Configuration
@Profile("cloud")
public class CloudConfiguration {
public class RepositoryConfiguration {

@Value("${repo.configFile}")
private String repositoryConfigFile = null;
@Bean
public RepositoryConfiguration repoConfiguration() throws Exception {
return RepositoryConfiguration.read(new ClassPathResource("vorto-repository-config-h2.json").getURL());
public org.modeshape.jcr.RepositoryConfiguration repoConfiguration() throws Exception {
return org.modeshape.jcr.RepositoryConfiguration.read(new ClassPathResource(repositoryConfigFile).getURL());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,15 @@
import org.eclipse.vorto.repository.model.Role;
import org.eclipse.vorto.repository.model.User;
import org.eclipse.vorto.repository.service.IUserRepository;
import org.modeshape.jcr.RepositoryConfiguration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.core.io.ClassPathResource;
import org.springframework.security.crypto.password.PasswordEncoder;

@Configuration
@Profile("local")
public class LocalConfiguration {

public class RepositoryConfigurationLocal extends org.eclipse.vorto.repository.web.config.RepositoryConfiguration {
@Autowired
private IUserRepository userRepository;

Expand All @@ -56,9 +53,4 @@ public void setUpTestUser() {

userRepository.save(user);
}

@Bean
public RepositoryConfiguration repoConfiguration() throws Exception {
return RepositoryConfiguration.read(new ClassPathResource("vorto-repository-config-file.json").getURL());
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
server:
port: 8080
contextPath: /infomodelrepository

mail:
smtp:
host: localhost
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
spring.datasource.testWhileIdle = true
spring.datasource.timeBetweenEvictionRunsMillis = 60000
spring.datasource.validationQuery = SELECT 1
spring.profiles.active=local
spring.jackson.serialization.write-dates-as-timestamps:false

repo.configFile: vorto-repository-config-file.json

0 comments on commit 9d06b52

Please sign in to comment.