From 0220b05ebe4cea365ac0a4aa4e35c0a50731d978 Mon Sep 17 00:00:00 2001 From: Jacob Haddad Date: Tue, 9 Apr 2024 12:38:41 -0700 Subject: [PATCH] bugfix(ClustConfig): prevent local network clustering by appending machine user name --- grails-app/init/io/xh/hoist/ClusterConfig.groovy | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/grails-app/init/io/xh/hoist/ClusterConfig.groovy b/grails-app/init/io/xh/hoist/ClusterConfig.groovy index 33fc6519..7dfcf448 100755 --- a/grails-app/init/io/xh/hoist/ClusterConfig.groovy +++ b/grails-app/init/io/xh/hoist/ClusterConfig.groovy @@ -16,9 +16,6 @@ import com.hazelcast.collection.ISet import com.hazelcast.config.MaxSizePolicy import com.hazelcast.config.NearCacheConfig import grails.core.GrailsClass -import io.xh.hoist.cache.Entry -import io.xh.hoist.cluster.ClusterResponse -import io.xh.hoist.cluster.ReplicatedValueEntry import io.xh.hoist.kryo.KryoSupport import static io.xh.hoist.util.InstanceConfigUtils.appEnvironment @@ -28,6 +25,7 @@ import static grails.util.Holders.grailsApplication import static io.xh.hoist.util.Utils.appBuild import static io.xh.hoist.util.Utils.appCode import static io.xh.hoist.util.Utils.appVersion +import static io.xh.hoist.util.Utils.isLocalDevelopment import static java.util.UUID.randomUUID class ClusterConfig { @@ -70,8 +68,9 @@ class ClusterConfig { */ protected String generateClusterName() { List ret = [appCode, appEnvironment, appVersion] - if (appVersion.contains('SNAPSHOT')) ret << appBuild + if (appVersion.contains('SNAPSHOT') && appBuild != 'UNKNOWN') ret << appBuild if (!multiInstanceEnabled) ret << randomUUID().toString().take(8) + if (isLocalDevelopment) ret << System.getProperty('user.name') return ret.join('-') }