DEV Community

Query Filter
Query Filter

Posted on

bridge31

SolaceKeyStorePath=#{T(java.nio.file.Paths).get('${spring.config.location}').getParent().resolve('comet.solace.' + T(java.nio.file.Paths).get('${spring.config.location}').getParent().getFileName() + '.keystore')}


############################################################################
# Derived variables (mimic original environment variables)
###############################################################################

# Directory containing this dds.properties
CONFIG_HOME=#{T(java.nio.file.Paths).get('${spring.config.location}').getParent().toString()}

# ENVNAME (last directory)
ENVNAME=#{T(java.nio.file.Paths).get('${CONFIG_HOME}').getFileName().toString()}

# REGION (one level up)
REGION=#{T(java.nio.file.Paths).get('${CONFIG_HOME}').getParent().getFileName().toString()}

# ASSETCLASS (two levels up)
ASSETCLASS=#{T(java.nio.file.Paths).get('${CONFIG_HOME}').getParent().getParent().getFileName().toString()}

# SPRING_BASE (three levels up)
SPRING_BASE=#{T(java.nio.file.Paths).get('${CONFIG_HOME}').getParent().getParent().getParent().getFileName().toString()}

###############################################################################
# Final keystore path (same format as original design)
###############################################################################

SolaceKeyStorePath=${CONFIG_HOME}/${SPRING_BASE}/${ASSETCLASS}/${REGION}/${ENVNAME}/comet.solace.${ENVNAME}.keystore

=================

###########################################################################
# Derive configuration from location of this properties file
###############################################################################

# directory containing dds.properties
CONFIG_HOME=#{T(java.nio.file.Paths).get('${spring.config.location}').getParent().toString()}

# extract path parts
ENVNAME=#{T(java.nio.file.Paths).get('${CONFIG_HOME}').getFileName().toString()}
REGION=#{T(java.nio.file.Paths).get('${CONFIG_HOME}').getParent().getFileName().toString()}
ASSETCLASS=#{T(java.nio.file.Paths).get('${CONFIG_HOME}').getParent().getParent().getFileName().toString()}
SPRING_BASE=#{T(java.nio.file.Paths).get('${CONFIG_HOME}').getParent().getParent().getParent().getFileName().toString()}

###############################################################################
# Final keystore path (no duplication)
###############################################################################

SolaceKeyStorePath=${CONFIG_HOME}/comet.solace.${ENVNAME}.keystore


----------------



# Directory containing dds.properties (classpath or filesystem)
CONFIG_HOME=#{T(org.springframework.core.io.ClassPathResource).new('dds.properties').getFile().getParent()}

# ENVNAME = last directory (e.g., qa, prod)
ENVNAME=#{T(java.nio.file.Paths).get('${CONFIG_HOME}').getFileName().toString()}

# REGION = one level up (e.g., US)
REGION=#{T(java.nio.file.Paths).get('${CONFIG_HOME}').getParent().getFileName().toString()}

# ASSETCLASS = two levels up (e.g., multi)
ASSETCLASS=#{T(java.nio.file.Paths).get('${CONFIG_HOME}').getParent().getParent().getFileName().toString()}

# SPRING_BASE = three levels up (e.g., quantum)













=#{T(java.nio.file.Paths).get('${CONFIG_HOME}').getParent().getParent().getParent().getFileName().toString()}

###############################################################################
# Final keystore path (all five variables used, like original design)
###############################################################################

SolaceKeyStorePath=${CONFIG_HOME}/${SPRING_BASE}/${ASSETCLASS}/${REGION}/${ENVNAME}/comet.solace.${ENVNAME}.keystore
Enter fullscreen mode Exit fullscreen mode

Top comments (0)