2020import com .arcadeanalytics .repository .search .WidgetSearchRepository ;
2121import org .slf4j .Logger ;
2222import org .slf4j .LoggerFactory ;
23+ import org .springframework .core .env .Environment ;
2324import org .springframework .stereotype .Service ;
2425import org .springframework .transaction .annotation .Transactional ;
2526
@@ -60,6 +61,8 @@ public class EnvironmentService {
6061
6162 private final FileSystemDataProvider fileSystemDataProvider ;
6263
64+ private final String templateUserName ;
65+
6366 public EnvironmentService (WorkspaceRepository workspaceRepository ,
6467 DashboardRepository dashboardRepository ,
6568 DataSetRepository dataSetRepository ,
@@ -70,7 +73,8 @@ public EnvironmentService(WorkspaceRepository workspaceRepository,
7073 CompanyRepository companyRepository ,
7174 DataSourceIndexRepository dataSourceIndexRepository ,
7275 ElasticGraphIndexerService elasticGraphIndexerService ,
73- FileSystemRepository fileSystemRepository ) {
76+ FileSystemRepository fileSystemRepository ,
77+ Environment env ) {
7478 this .workspaceRepository = workspaceRepository ;
7579 this .dashboardRepository = dashboardRepository ;
7680 this .dataSetRepository = dataSetRepository ;
@@ -83,6 +87,9 @@ public EnvironmentService(WorkspaceRepository workspaceRepository,
8387 this .elasticGraphIndexerService = elasticGraphIndexerService ;
8488 this .fileSystemDataProvider = new FileSystemDataProvider (fileSystemRepository );
8589
90+ templateUserName = env .getProperty ("application.templateUser" , TEMPLATE_USER_NAME );
91+
92+ log .info ("template user name is:: {}" , templateUserName );
8693 }
8794
8895 /**
@@ -127,7 +134,7 @@ public void createBaseEnvironment(User user, ContractType contractType) {
127134
128135 private boolean createDataSources (Workspace workspace , Dashboard dashboard ) {
129136
130- widgetRepository .findByDashboardWorkspaceUserUserLogin (TEMPLATE_USER_NAME )
137+ widgetRepository .findByDashboardWorkspaceUserUserLogin (templateUserName )
131138 .stream ()
132139 .forEach (widget -> {
133140
0 commit comments