Skip to main content
Glama
ReadConfig.java2.41 kB
/* * The MIT License (MIT) * * Copyright (c) 2025 Dmitry Degrave * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.dnaerys.client; import java.io.IOException; import java.io.InputStream; import java.util.Properties; /** * Config file utilities. * * @author Dmitry Degrave (info@dnaerys.org) * @version 1.0 */ public class ReadConfig { private static final String propFileName = "dnaerys.properties"; private static final Properties prop = readConfig(); private static Properties readConfig() { Properties p = new Properties(); // defaults for missing values p.setProperty("dnaerysHost","db.dnaerys.org"); p.setProperty("dnaerysGRPCPort","7443"); p.setProperty("ssl","true"); try (InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(propFileName)) { if (inputStream != null) { p.load(inputStream); } } catch (IOException e) { // discards all values from failed stream Properties pd = new Properties(); pd.setProperty("dnaerysHost","db.dnaerys.org"); pd.setProperty("dnaerysGRPCPort","7443"); pd.setProperty("ssl","true"); return pd; } return p; } public static Properties getProp() { return prop; } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/de-grave/OneKGP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server