mirror of
				https://github.com/open-metadata/OpenMetadata.git
				synced 2025-10-31 02:29:03 +00:00 
			
		
		
		
	Add Sync Option in OpenmetadataOperations (#17089)
This commit is contained in:
		
							parent
							
								
									c7710481b5
								
							
						
					
					
						commit
						8561022c70
					
				| @ -44,6 +44,8 @@ import org.openmetadata.schema.ServiceEntityInterface; | ||||
| import org.openmetadata.schema.entity.app.App; | ||||
| import org.openmetadata.schema.entity.app.AppRunRecord; | ||||
| import org.openmetadata.schema.entity.services.ingestionPipelines.IngestionPipeline; | ||||
| import org.openmetadata.schema.settings.Settings; | ||||
| import org.openmetadata.schema.settings.SettingsType; | ||||
| import org.openmetadata.schema.system.EventPublisherJob; | ||||
| import org.openmetadata.schema.type.Include; | ||||
| import org.openmetadata.sdk.PipelineServiceClientInterface; | ||||
| @ -60,6 +62,7 @@ import org.openmetadata.service.jdbi3.EntityRepository; | ||||
| import org.openmetadata.service.jdbi3.IngestionPipelineRepository; | ||||
| import org.openmetadata.service.jdbi3.ListFilter; | ||||
| import org.openmetadata.service.jdbi3.MigrationDAO; | ||||
| import org.openmetadata.service.jdbi3.SystemRepository; | ||||
| import org.openmetadata.service.jdbi3.locator.ConnectionAwareAnnotationSqlLocator; | ||||
| import org.openmetadata.service.jdbi3.locator.ConnectionType; | ||||
| import org.openmetadata.service.migration.api.MigrationWorkflow; | ||||
| @ -160,6 +163,26 @@ public class OpenMetadataOperations implements Callable<Integer> { | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   @Command( | ||||
|       name = "syncEmailFromEnv", | ||||
|       description = "Sync the email configuration from environment variables") | ||||
|   public Integer syncEmailFromEnv() { | ||||
|     try { | ||||
|       parseConfig(); | ||||
|       Entity.setCollectionDAO(jdbi.onDemand(CollectionDAO.class)); | ||||
|       SystemRepository systemRepository = new SystemRepository(); | ||||
|       Settings updatedSettings = | ||||
|           new Settings() | ||||
|               .withConfigType(SettingsType.EMAIL_CONFIGURATION) | ||||
|               .withConfigValue(config.getSmtpSettings()); | ||||
|       systemRepository.createOrUpdate(updatedSettings); | ||||
|       return 0; | ||||
|     } catch (Exception e) { | ||||
|       LOG.error("Email Sync failed due to ", e); | ||||
|       return 1; | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   @Command( | ||||
|       name = "check-connection", | ||||
|       description = | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Mohit Yadav
						Mohit Yadav