记得上下班打卡 | git大法好,push需谨慎

Commit 449c62fd authored by 张国柄's avatar 张国柄

opt config;

parent b8ce05f8
package com.liquidnet.service.kylin.config;
/**
* @author AnJiabin <jiabin.an@lightnet.io>
* @version V1.0
* @Description:
* @class: MongoSSL
* @Package com.liquidnet.service.adam.config
* @Copyright: LightNet @ Copyright (c) 2020
* @date 2020/12/18 11:51 上午
*/
import com.mongodb.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
//mongoSSl连接配置类
//@Slf4j
//@Configuration
public class MongoSslConfig {
@Value("${spring.data.mongodb.trustStore}")
private String trustStore;
@Value("${spring.data.mongodb.trustStorePassword}")
private String trustStorePassword;
@Value("${spring.data.mongodb.uri}")
private String mongodbUri;
@Value("${spring.data.mongodb.sslEnabled}")
private boolean sslEnabled;
// @Bean
public MongoClient createMongoClientByUri() {
// log.info("MongoSslConfig trustStore:{}",trustStore);
// log.info("MongoSslConfig trustStorePassword:{}",trustStorePassword);
// log.info("MongoSslConfig mongodbUri:{}",mongodbUri);
// log.info("MongoSslConfig sslEnabled:{}",sslEnabled);
System.setProperty("javax.net.ssl.trustStore",trustStore);
System.setProperty("javax.net.ssl.trustStorePassword",trustStorePassword);
MongoClientURI uri = new MongoClientURI(mongodbUri,MongoClientOptions.builder().sslEnabled(sslEnabled));
return new MongoClient(uri);
}
}
......@@ -7,4 +7,8 @@ liquidnet:
password: user123
eureka:
host: 127.0.0.1:7001
# end-dev-这里是配置信息基本值
\ No newline at end of file
# end-dev-这里是配置信息基本值
spring:
profiles:
include: service-kylin
......@@ -9,7 +9,7 @@ eureka:
spring:
cloud:
config:
# uri: http://127.0.0.1:7002/support-config
# uri: http://127.0.0.1:7002/support-config
profile: ${liquidnet.cloudConfig.profile}
name: ${spring.application.name} #默认为spring.application.name
discovery:
......
spring:
application:
name: liquidnet-service-kylin
profiles:
active: dev
\ No newline at end of file
application:
name: liquidnet-service-kylin
profiles:
active: dev
\ No newline at end of file
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