@solongate/proxy 0.1.17 → 0.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.js +34 -28
  2. package/dist/init.js +34 -28
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -141,6 +141,36 @@ POLICY PRESETS
141
141
  `;
142
142
  console.error(help);
143
143
  }
144
+ function ensureEnvFile() {
145
+ const envPath = resolve2(".env");
146
+ if (!existsSync2(envPath)) {
147
+ const envContent = `# SolonGate API Keys
148
+ # Get your keys from the dashboard: https://solongate.com
149
+ # IMPORTANT: Never commit this file to git!
150
+
151
+ # Live key \u2014 enables cloud policy sync + audit logging to dashboard
152
+ SOLONGATE_API_KEY=sg_live_your_key_here
153
+
154
+ # Test key \u2014 local-only, no cloud connection (for development)
155
+ # SOLONGATE_API_KEY=sg_test_your_key_here
156
+ `;
157
+ writeFileSync(envPath, envContent);
158
+ console.error(` Created .env with placeholder API keys`);
159
+ console.error(` \u2192 Edit .env and replace with your real keys from https://solongate.com`);
160
+ console.error("");
161
+ }
162
+ const gitignorePath = resolve2(".gitignore");
163
+ if (existsSync2(gitignorePath)) {
164
+ const gitignore = readFileSync2(gitignorePath, "utf-8");
165
+ if (!gitignore.includes(".env")) {
166
+ writeFileSync(gitignorePath, gitignore.trimEnd() + "\n.env\n.env.local\n");
167
+ console.error(` Added .env to .gitignore`);
168
+ }
169
+ } else {
170
+ writeFileSync(gitignorePath, ".env\n.env.local\nnode_modules/\n");
171
+ console.error(` Created .gitignore (with .env excluded)`);
172
+ }
173
+ }
144
174
  async function main() {
145
175
  const options = parseInitArgs(process.argv);
146
176
  const _c = {
@@ -176,6 +206,7 @@ async function main() {
176
206
  console.error(" No MCP config file found.");
177
207
  console.error(" Searched: .mcp.json, mcp.json, Claude Desktop config");
178
208
  console.error("");
209
+ ensureEnvFile();
179
210
  console.error(" Create a .mcp.json file first, or specify --config <path>");
180
211
  process.exit(1);
181
212
  }
@@ -218,6 +249,7 @@ async function main() {
218
249
  console.error("");
219
250
  if (alreadyProtected.length === serverNames.length) {
220
251
  console.error(" All servers are already protected by SolonGate!");
252
+ ensureEnvFile();
221
253
  process.exit(0);
222
254
  }
223
255
  if (!options.all) {
@@ -233,6 +265,7 @@ async function main() {
233
265
  }
234
266
  if (toProtect.length === 0) {
235
267
  console.error(" No servers selected for protection.");
268
+ ensureEnvFile();
236
269
  process.exit(0);
237
270
  }
238
271
  console.error("");
@@ -278,34 +311,7 @@ async function main() {
278
311
  console.error(" \u2502 To undo: solongate-init --restore \u2502");
279
312
  console.error(" \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518");
280
313
  console.error("");
281
- const envPath = resolve2(".env");
282
- if (!existsSync2(envPath)) {
283
- const envContent = `# SolonGate API Keys
284
- # Get your keys from the dashboard: https://solongate.com
285
- # IMPORTANT: Never commit this file to git!
286
-
287
- # Live key \u2014 enables cloud policy sync + audit logging to dashboard
288
- SOLONGATE_API_KEY=sg_live_your_key_here
289
-
290
- # Test key \u2014 local-only, no cloud connection (for development)
291
- # SOLONGATE_API_KEY=sg_test_your_key_here
292
- `;
293
- writeFileSync(envPath, envContent);
294
- console.error(` Created .env with placeholder API keys`);
295
- console.error(` \u2192 Edit .env and replace with your real keys from https://solongate.com`);
296
- console.error("");
297
- }
298
- const gitignorePath = resolve2(".gitignore");
299
- if (existsSync2(gitignorePath)) {
300
- const gitignore = readFileSync2(gitignorePath, "utf-8");
301
- if (!gitignore.includes(".env")) {
302
- writeFileSync(gitignorePath, gitignore.trimEnd() + "\n.env\n.env.local\n");
303
- console.error(` Added .env to .gitignore`);
304
- }
305
- } else {
306
- writeFileSync(gitignorePath, ".env\n.env.local\nnode_modules/\n");
307
- console.error(` Created .gitignore (with .env excluded)`);
308
- }
314
+ ensureEnvFile();
309
315
  console.error("");
310
316
  for (const name of toProtect) {
311
317
  console.error(` \u2713 ${name} \u2014 protected (${options.policy})`);
package/dist/init.js CHANGED
@@ -143,6 +143,36 @@ POLICY PRESETS
143
143
  `;
144
144
  console.error(help);
145
145
  }
146
+ function ensureEnvFile() {
147
+ const envPath = resolve(".env");
148
+ if (!existsSync(envPath)) {
149
+ const envContent = `# SolonGate API Keys
150
+ # Get your keys from the dashboard: https://solongate.com
151
+ # IMPORTANT: Never commit this file to git!
152
+
153
+ # Live key \u2014 enables cloud policy sync + audit logging to dashboard
154
+ SOLONGATE_API_KEY=sg_live_your_key_here
155
+
156
+ # Test key \u2014 local-only, no cloud connection (for development)
157
+ # SOLONGATE_API_KEY=sg_test_your_key_here
158
+ `;
159
+ writeFileSync(envPath, envContent);
160
+ console.error(` Created .env with placeholder API keys`);
161
+ console.error(` \u2192 Edit .env and replace with your real keys from https://solongate.com`);
162
+ console.error("");
163
+ }
164
+ const gitignorePath = resolve(".gitignore");
165
+ if (existsSync(gitignorePath)) {
166
+ const gitignore = readFileSync(gitignorePath, "utf-8");
167
+ if (!gitignore.includes(".env")) {
168
+ writeFileSync(gitignorePath, gitignore.trimEnd() + "\n.env\n.env.local\n");
169
+ console.error(` Added .env to .gitignore`);
170
+ }
171
+ } else {
172
+ writeFileSync(gitignorePath, ".env\n.env.local\nnode_modules/\n");
173
+ console.error(` Created .gitignore (with .env excluded)`);
174
+ }
175
+ }
146
176
  async function main() {
147
177
  const options = parseInitArgs(process.argv);
148
178
  const _c = {
@@ -178,6 +208,7 @@ async function main() {
178
208
  console.error(" No MCP config file found.");
179
209
  console.error(" Searched: .mcp.json, mcp.json, Claude Desktop config");
180
210
  console.error("");
211
+ ensureEnvFile();
181
212
  console.error(" Create a .mcp.json file first, or specify --config <path>");
182
213
  process.exit(1);
183
214
  }
@@ -220,6 +251,7 @@ async function main() {
220
251
  console.error("");
221
252
  if (alreadyProtected.length === serverNames.length) {
222
253
  console.error(" All servers are already protected by SolonGate!");
254
+ ensureEnvFile();
223
255
  process.exit(0);
224
256
  }
225
257
  if (!options.all) {
@@ -235,6 +267,7 @@ async function main() {
235
267
  }
236
268
  if (toProtect.length === 0) {
237
269
  console.error(" No servers selected for protection.");
270
+ ensureEnvFile();
238
271
  process.exit(0);
239
272
  }
240
273
  console.error("");
@@ -280,34 +313,7 @@ async function main() {
280
313
  console.error(" \u2502 To undo: solongate-init --restore \u2502");
281
314
  console.error(" \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518");
282
315
  console.error("");
283
- const envPath = resolve(".env");
284
- if (!existsSync(envPath)) {
285
- const envContent = `# SolonGate API Keys
286
- # Get your keys from the dashboard: https://solongate.com
287
- # IMPORTANT: Never commit this file to git!
288
-
289
- # Live key \u2014 enables cloud policy sync + audit logging to dashboard
290
- SOLONGATE_API_KEY=sg_live_your_key_here
291
-
292
- # Test key \u2014 local-only, no cloud connection (for development)
293
- # SOLONGATE_API_KEY=sg_test_your_key_here
294
- `;
295
- writeFileSync(envPath, envContent);
296
- console.error(` Created .env with placeholder API keys`);
297
- console.error(` \u2192 Edit .env and replace with your real keys from https://solongate.com`);
298
- console.error("");
299
- }
300
- const gitignorePath = resolve(".gitignore");
301
- if (existsSync(gitignorePath)) {
302
- const gitignore = readFileSync(gitignorePath, "utf-8");
303
- if (!gitignore.includes(".env")) {
304
- writeFileSync(gitignorePath, gitignore.trimEnd() + "\n.env\n.env.local\n");
305
- console.error(` Added .env to .gitignore`);
306
- }
307
- } else {
308
- writeFileSync(gitignorePath, ".env\n.env.local\nnode_modules/\n");
309
- console.error(` Created .gitignore (with .env excluded)`);
310
- }
316
+ ensureEnvFile();
311
317
  console.error("");
312
318
  for (const name of toProtect) {
313
319
  console.error(` \u2713 ${name} \u2014 protected (${options.policy})`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solongate/proxy",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
4
4
  "description": "MCP security proxy \u00e2\u20ac\u201d protect any MCP server with policies, input validation, rate limiting, and audit logging. Zero code changes required.",
5
5
  "type": "module",
6
6
  "bin": {