java-meow opened a new issue, #35192:
URL: https://github.com/apache/shardingsphere/issues/35192

   ```java
   Exception in thread "main" java.lang.NumberFormatException: For input 
string: ""
        at 
java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
        at java.base/java.lang.Integer.parseInt(Integer.java:672)
        at java.base/java.lang.Integer.parseInt(Integer.java:778)
        at 
org.apache.shardingsphere.infra.database.core.connector.url.StandardJdbcUrlParser.parsePort(StandardJdbcUrlParser.java:76)
        at 
org.apache.shardingsphere.infra.database.core.connector.url.StandardJdbcUrlParser.parse(StandardJdbcUrlParser.java:61)
        at 
org.apache.shardingsphere.infra.database.mysql.connector.MySQLConnectionPropertiesParser.parse(MySQLConnectionPropertiesParser.java:37)
        at 
org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitNodeMapCreator.create(StorageUnitNodeMapCreator.java:60)
        at 
org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitNodeMapCreator.create(StorageUnitNodeMapCreator.java:54)
        at 
org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitNodeMapCreator.lambda$create$0(StorageUnitNodeMapCreator.java:49)
        at 
java.base/java.util.stream.Collectors.lambda$toMap$68(Collectors.java:1637)
        at 
java.base/java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
        at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
        at 
java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1939)
        at 
java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
        at 
java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
        at 
java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
        at 
java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at 
java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
        at 
org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnitNodeMapCreator.create(StorageUnitNodeMapCreator.java:49)
        at 
org.apache.shardingsphere.infra.config.database.impl.DataSourceGeneratedDatabaseConfiguration.<init>(DataSourceGeneratedDatabaseConfiguration.java:55)
        at 
org.apache.shardingsphere.proxy.backend.config.yaml.swapper.YamlProxyConfigurationSwapper.swapDatabaseConfigurations(YamlProxyConfigurationSwapper.java:84)
        at 
org.apache.shardingsphere.proxy.backend.config.yaml.swapper.YamlProxyConfigurationSwapper.swap(YamlProxyConfigurationSwapper.java:60)
        at 
org.apache.shardingsphere.proxy.initializer.BootstrapInitializer.init(BootstrapInitializer.java:51)
        at org.apache.shardingsphere.proxy.Bootstrap.main(Bootstrap.java:64)
   ```
   
   I met such a problem when I tried to replace the specific datasource url by 
environment variables. I checked there is a sample configuration guideline in 
Shardingsphere JDBC 
[documentation](https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-jdbc/yaml-config/jdbc-driver/known-implementation/),
 but no similar content is mentioned in the Proxy part.
   
   Within the proxy Yaml configuration file, I tried what is described in the 
JDBC part documentation but obviously it doesn't work. 
   
   As my understanding, the log is saying it cannot parse datasource URLs 
properly.
   My Shardingsphere Proxy configuration file looks like below:
   
   ```yml
   # global.yaml
   
   authority:
     users:
       - user: root@%
         password: dbproxy
         admin: true
       - user: dbproxy
         password: dbproxy
     privilege:
       type: ALL_PERMITTED
   
   sqlFederation:
     sqlFederationEnabled: true
     executionPlanCache:
       initialCapacity: 2000
       maximumSize: 65535
   
   props:
     sql-show: false
   ```
   
   ```yml
   # datasource.yaml
   
   databaseName: db_proxy
   
   dataSources:
     db_core:
       url: 
jdbc:mysql://$${DB_CORE::mysql_core:3306}/ttsa_server?useSSL=true&placeholder-type=environment
       username: myusername
       password: mypassword
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
       minPoolSize: 1
   ```
   Where `DB_CORE` is an environment variable with a preset value by executing 
commands like `export DB_CORE=ip_address:port_no`.
   
   Before I changed the datasource configuration file like this, I have tried 
to put the exact IP address and port number the database is located, and it 
works.
   
   Does the proxy project support putting placeholders in Yaml configuration 
files? If yes, how I can approach it?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: 
notifications-unsubscr...@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to