Skip to content

Commit

Permalink
bugfix: prefix: [seata.server.raft.ssl] should not be null
Browse files Browse the repository at this point in the history
  • Loading branch information
funky-eyes committed Jan 16, 2025
1 parent e603de5 commit 61eae9f
Show file tree
Hide file tree
Showing 11 changed files with 410 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -966,14 +966,24 @@ public interface ConfigurationKeys {


/**
* The constant SERVER_RAFT_SSL_KEYSTORE_TYPE.
* The constant SERVER_RAFT_SSL_CLIENT_KEYSTORE_TYPE.
*/
String SERVER_RAFT_SSL_KEYSTORE_TYPE = SERVER_RAFT_SSL + "keystore.type";
String SERVER_RAFT_SSL_CLIENT_KEYSTORE_TYPE = SERVER_RAFT_SSL_CLIENT + "keystore.type";

/**
* The constant SERVER_RAFT_SSL_SERVER_KEYSTORE_TYPE.
*/
String SERVER_RAFT_SSL_SERVER_KEYSTORE_TYPE = SERVER_RAFT_SSL_SERVER + "keystore.type";

/**
* The constant SERVER_RAFT_SSL_KMF_ALGORITHM.
*/
String SERVER_RAFT_SSL_KMF_ALGORITHM = SERVER_RAFT_SSL + "kmfAlgorithm";

/**
* The constant SERVER_RAFT_SSL_KMF_ALGORITHM.
*/
String SERVER_RAFT_SSL_KMF_ALGORITHM = SERVER_RAFT_SSL + "kmf.algorithm";
String SERVER_RAFT_SSL_TMF_ALGORITHM = SERVER_RAFT_SSL + "tmfAlgorithm";

/**
* The constant SERVER_RAFT_MAX_APPEND_BUFFER_SIZE.
Expand Down Expand Up @@ -1110,4 +1120,15 @@ public interface ConfigurationKeys {
* The constant META_PREFIX
*/
String META_PREFIX = SEATA_FILE_ROOT_CONFIG + FILE_CONFIG_SPLIT_CHAR + FILE_ROOT_REGISTRY + FILE_CONFIG_SPLIT_CHAR + "metadata.";

/**
* The constant SERVER_REGISTRY_METADATA_PREFIX
*/
String SERVER_REGISTRY_METADATA_PREFIX = SERVER_PREFIX + FILE_ROOT_REGISTRY + ".metadata";

/**
* The constant SERVER_REGISTRY_METADATA_EXTERNAL
*/
String SERVER_REGISTRY_METADATA_EXTERNAL = SERVER_REGISTRY_METADATA_PREFIX + ".external";

}
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ public interface StarterConstants {
String SERVER_PREFIX = SEATA_PREFIX + ".server";
String SERVER_UNDO_PREFIX = SERVER_PREFIX + ".undo";
String SERVER_RAFT_PREFIX = SERVER_PREFIX + ".raft";
String SERVER_RAFT_SSL_PREFIX = SERVER_RAFT_PREFIX + ".ssl";
String SERVER_RAFT_SSL_CLIENT_KEYSTORE_PREFIX = SERVER_RAFT_SSL_PREFIX + ".client.keystore";
String SERVER_RAFT_SSL_SERVER_KEYSTORE_PREFIX = SERVER_RAFT_SSL_PREFIX + ".server.keystore";
String SERVER_RECOVERY_PREFIX = SERVER_PREFIX + ".recovery";

String METRICS_PREFIX = SEATA_PREFIX + ".metrics";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@
package org.apache.seata.spring.boot.autoconfigure;

import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.seata.spring.boot.autoconfigure.properties.server.raft.ServerRaftSSLClientProperties;
import org.apache.seata.spring.boot.autoconfigure.properties.server.raft.ServerRaftSSLProperties;
import org.apache.seata.spring.boot.autoconfigure.properties.server.raft.ServerRaftSSLServerProperties;
import org.apache.seata.spring.boot.autoconfigure.properties.server.store.StoreProperties;
import org.apache.seata.spring.boot.autoconfigure.properties.server.MetricsProperties;
import org.apache.seata.spring.boot.autoconfigure.properties.server.ServerProperties;
import org.apache.seata.spring.boot.autoconfigure.properties.server.ServerRaftProperties;
import org.apache.seata.spring.boot.autoconfigure.properties.server.raft.ServerRaftProperties;
import org.apache.seata.spring.boot.autoconfigure.properties.server.ServerRecoveryProperties;
import org.apache.seata.spring.boot.autoconfigure.properties.server.ServerUndoProperties;
import org.apache.seata.spring.boot.autoconfigure.properties.server.session.SessionProperties;
Expand All @@ -38,6 +41,9 @@
import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.PROPERTY_BEAN_MAP;
import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_PREFIX;
import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_RAFT_PREFIX;
import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_RAFT_SSL_CLIENT_KEYSTORE_PREFIX;
import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_RAFT_SSL_PREFIX;
import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_RAFT_SSL_SERVER_KEYSTORE_PREFIX;
import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_RECOVERY_PREFIX;
import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_UNDO_PREFIX;
import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SESSION_PREFIX;
Expand Down Expand Up @@ -79,6 +85,9 @@ public static void init() {
PROPERTY_BEAN_MAP.put(STORE_REDIS_SINGLE_PREFIX, StoreRedisProperties.Single.class);
PROPERTY_BEAN_MAP.put(STORE_REDIS_SENTINEL_PREFIX, StoreRedisProperties.Sentinel.class);
PROPERTY_BEAN_MAP.put(SERVER_RAFT_PREFIX, ServerRaftProperties.class);
PROPERTY_BEAN_MAP.put(SERVER_RAFT_SSL_SERVER_KEYSTORE_PREFIX, ServerRaftSSLServerProperties.class);
PROPERTY_BEAN_MAP.put(SERVER_RAFT_SSL_PREFIX, ServerRaftSSLProperties.class);
PROPERTY_BEAN_MAP.put(SERVER_RAFT_SSL_CLIENT_KEYSTORE_PREFIX, ServerRaftSSLClientProperties.class);
PROPERTY_BEAN_MAP.put(SESSION_PREFIX, SessionProperties.class);
PROPERTY_BEAN_MAP.put(STORE_PREFIX, StoreProperties.class);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.seata.spring.boot.autoconfigure.properties.server.raft;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;


import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_RAFT_PREFIX;


@Component
@ConfigurationProperties(prefix = SERVER_RAFT_PREFIX)
public class ServerRaftProperties {

private String serverAddr;

private String group;

private Boolean autoJoin = false;

private Integer snapshotInterval = 600;

private Integer applyBatch = 32;

private Integer maxAppendBufferSize = 256 * 1024;

private Integer maxReplicatorInflightMsgs = 256;

private Integer disruptorBufferSize = 16384;

private Integer electionTimeoutMs = 1000;

private boolean reporterEnabled = false;

private Integer reporterInitialDelay = 60;

private String serialization = "jackson";

private String compressor = "none";

private boolean sync = true;

public String getServerAddr() {
return serverAddr;
}

public ServerRaftProperties setServerAddr(String serverAddr) {
this.serverAddr = serverAddr;
return this;
}

public Integer getSnapshotInterval() {
return snapshotInterval;
}

public ServerRaftProperties setSnapshotInterval(Integer snapshotInterval) {
this.snapshotInterval = snapshotInterval;
return this;
}

public Integer getApplyBatch() {
return applyBatch;
}

public ServerRaftProperties setApplyBatch(Integer applyBatch) {
this.applyBatch = applyBatch;
return this;
}

public Integer getMaxAppendBufferSize() {
return maxAppendBufferSize;
}

public ServerRaftProperties setMaxAppendBufferSize(Integer maxAppendBufferSize) {
this.maxAppendBufferSize = maxAppendBufferSize;
return this;
}

public Integer getMaxReplicatorInflightMsgs() {
return maxReplicatorInflightMsgs;
}

public ServerRaftProperties setMaxReplicatorInflightMsgs(Integer maxReplicatorInflightMsgs) {
this.maxReplicatorInflightMsgs = maxReplicatorInflightMsgs;
return this;
}

public Integer getDisruptorBufferSize() {
return disruptorBufferSize;
}

public ServerRaftProperties setDisruptorBufferSize(Integer disruptorBufferSize) {
this.disruptorBufferSize = disruptorBufferSize;
return this;
}

public Integer getElectionTimeoutMs() {
return electionTimeoutMs;
}

public ServerRaftProperties setElectionTimeoutMs(Integer electionTimeoutMs) {
this.electionTimeoutMs = electionTimeoutMs;
return this;
}

public boolean isReporterEnabled() {
return reporterEnabled;
}

public ServerRaftProperties setReporterEnabled(boolean reporterEnabled) {
this.reporterEnabled = reporterEnabled;
return this;
}

public Integer getReporterInitialDelay() {
return reporterInitialDelay;
}

public ServerRaftProperties setReporterInitialDelay(Integer reporterInitialDelay) {
this.reporterInitialDelay = reporterInitialDelay;
return this;
}

public Boolean getAutoJoin() {
return autoJoin;
}

public ServerRaftProperties setAutoJoin(Boolean autoJoin) {
this.autoJoin = autoJoin;
return this;
}

public String getSerialization() {
return serialization;
}

public void setSerialization(String serialization) {
this.serialization = serialization;
}

public String getCompressor() {
return compressor;
}

public void setCompressor(String compressor) {
this.compressor = compressor;
}

public String getGroup() {
return group;
}

public void setGroup(String group) {
this.group = group;
}

public boolean isSync() {
return sync;
}

public void setSync(boolean sync) {
this.sync = sync;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.seata.spring.boot.autoconfigure.properties.server.raft;

import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_RAFT_SSL_CLIENT_KEYSTORE_PREFIX;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Component
@ConfigurationProperties(prefix = SERVER_RAFT_SSL_CLIENT_KEYSTORE_PREFIX)
public class ServerRaftSSLClientProperties {

private String path = "ssl/cbolt.pfx";

private String password = "password";

private String type = "pkcs12";

public String getPath() {
return path;
}

public void setPath(String path) {
this.path = path;
}

public String getPassword() {
return password;
}

public void setPassword(String password) {
this.password = password;
}

public String getType() {
return type;
}

public void setType(String type) {
this.type = type;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.seata.spring.boot.autoconfigure.properties.server.raft;

import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_RAFT_SSL_PREFIX;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Component
@ConfigurationProperties(prefix = SERVER_RAFT_SSL_PREFIX)
public class ServerRaftSSLProperties {

private Boolean enabled = false;

private String kmfAlgorithm = "SunX509";

private String tmfAlgorithm = "SunX509";

public Boolean getEnabled() {
return enabled;
}

public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}

public String getKmfAlgorithm() {
return kmfAlgorithm;
}

public void setKmfAlgorithm(String kmfAlgorithm) {
this.kmfAlgorithm = kmfAlgorithm;
}

public String getTmfAlgorithm() {
return tmfAlgorithm;
}

public void setTmfAlgorithm(String tmfAlgorithm) {
this.tmfAlgorithm = tmfAlgorithm;
}
}
Loading

0 comments on commit 61eae9f

Please sign in to comment.