<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Environment-Variables on D5N</title><link>https://www.d5n.xyz/tags/environment-variables/</link><description>Recent content in Environment-Variables on D5N</description><generator>Hugo -- 0.146.5</generator><language>zh-CN</language><lastBuildDate>Tue, 03 Mar 2026 22:00:00 +0800</lastBuildDate><atom:link href="https://www.d5n.xyz/tags/environment-variables/index.xml" rel="self" type="application/rss+xml"/><item><title>OpenClaw API Key Management: Environment Variables Best Practices</title><link>https://www.d5n.xyz/en/posts/openclaw-secretref-guide/</link><pubDate>Tue, 03 Mar 2026 22:00:00 +0800</pubDate><guid>https://www.d5n.xyz/en/posts/openclaw-secretref-guide/</guid><description>&lt;h2 id="the-problem-with-plaintext-keys">The Problem with Plaintext Keys&lt;/h2>
&lt;p>When setting up OpenClaw, you&amp;rsquo;re dealing with sensitive credentials:&lt;/p>
&lt;ul>
&lt;li>Discord Bot Tokens&lt;/li>
&lt;li>AI API Keys (Kimi, OpenAI, etc.)&lt;/li>
&lt;li>Service credentials&lt;/li>
&lt;/ul>
&lt;p>&lt;strong>The temptation:&lt;/strong> Just paste them into &lt;code>openclaw.json&lt;/code>&lt;/p>
&lt;p>&lt;strong>The risk:&lt;/strong> One accidental git commit, and your keys are public.&lt;/p>
&lt;hr>
&lt;h2 id="the-solution-environment-variables">The Solution: Environment Variables&lt;/h2>
&lt;p>OpenClaw supports referencing environment variables in configuration. Your config file only contains placeholders, actual values live in environment variables.&lt;/p>
&lt;h3 id="how-it-works">How It Works&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-json" data-lang="json">&lt;span style="display:flex;">&lt;span>{
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">&amp;#34;channels&amp;#34;&lt;/span>: {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">&amp;#34;discord&amp;#34;&lt;/span>: {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">&amp;#34;token&amp;#34;&lt;/span>: &lt;span style="color:#e6db74">&amp;#34;${env:DISCORD_BOT_TOKEN}&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The &lt;code>${env:VAR_NAME}&lt;/code> syntax tells OpenClaw to read from environment variables at runtime.&lt;/p></description></item></channel></rss>