-
Notifications
You must be signed in to change notification settings - Fork 0
Update README with Docker instructions #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7589504
9e0a564
ddda8f7
ef14d7c
a883f2c
3561d2d
3af6f7b
02b473b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -10,9 +10,48 @@ public class ConfigLoader { | |||||||||||
|
|
||||||||||||
| public static OpenClawConfig load() throws IOException { | ||||||||||||
| File configFile = CONFIG_PATH.toFile(); | ||||||||||||
| if (!configFile.exists()) { | ||||||||||||
| throw new IOException("Config file not found: " + CONFIG_PATH); | ||||||||||||
| OpenClawConfig config; | ||||||||||||
|
|
||||||||||||
| if (configFile.exists()) { | ||||||||||||
| config = Json.mapper().readValue(configFile, OpenClawConfig.class); | ||||||||||||
| } else { | ||||||||||||
| String apiKey = System.getenv("ANTHROPIC_API_KEY"); | ||||||||||||
| if (apiKey != null && !apiKey.isEmpty()) { | ||||||||||||
| config = new OpenClawConfig(); | ||||||||||||
| config.setGateway(new OpenClawConfig.GatewayConfig()); | ||||||||||||
| config.setAgent(new OpenClawConfig.AgentConfig()); | ||||||||||||
| config.getAgent().setApiKey(apiKey); | ||||||||||||
| } else { | ||||||||||||
| throw new IOException( | ||||||||||||
| "Config file not found: " + CONFIG_PATH + " and ANTHROPIC_API_KEY env var is not set."); | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| // Allow environment variables to override config | ||||||||||||
| String envKey = System.getenv("ANTHROPIC_API_KEY"); | ||||||||||||
| if (envKey != null && !envKey.isEmpty()) { | ||||||||||||
| if (config.getAgent() == null) | ||||||||||||
| config.setAgent(new OpenClawConfig.AgentConfig()); | ||||||||||||
| config.getAgent().setApiKey(envKey); | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| String envPort = System.getenv("GATEWAY_PORT"); | ||||||||||||
| if (envPort != null && !envPort.isEmpty()) { | ||||||||||||
| if (config.getGateway() == null) | ||||||||||||
| config.setGateway(new OpenClawConfig.GatewayConfig()); | ||||||||||||
| try { | ||||||||||||
| config.getGateway().setPort(Integer.parseInt(envPort)); | ||||||||||||
| } catch (NumberFormatException ignored) { | ||||||||||||
| } | ||||||||||||
|
Comment on lines
+44
to
+45
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Silent failure on invalid GATEWAY_PORT environment variable When Impact and DetailsAt } catch (NumberFormatException ignored) {
}This means if a user sets
Suggested change
Was this helpful? React with 👍 or 👎 to provide feedback. |
||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| String envToken = System.getenv("GATEWAY_AUTH_TOKEN"); | ||||||||||||
| if (envToken != null && !envToken.isEmpty()) { | ||||||||||||
| if (config.getGateway() == null) | ||||||||||||
| config.setGateway(new OpenClawConfig.GatewayConfig()); | ||||||||||||
| config.getGateway().setAuthToken(envToken); | ||||||||||||
| } | ||||||||||||
| return Json.mapper().readValue(configFile, OpenClawConfig.class); | ||||||||||||
|
|
||||||||||||
| return config; | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
Uh oh!
There was an error while loading. Please reload this page.