Skip to content

Commit

Permalink
fix: delete a subdomain error message
Browse files Browse the repository at this point in the history
  • Loading branch information
bitsnaps committed Feb 13, 2025
1 parent 903ecb7 commit ed676dc
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 12 deletions.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Default Puter's API
PUTER_API_BASE='https://api.puter.com'
PUTER_BASE_URL='https://puter.com'
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,12 @@ If you want to customize this tool you can follow these steps:
```bash
npm install
```
3. Link the CLI globally:
3. Set your own variable environnements:
```
cp .env.example .env
# update your own values in .env file
```
4. Link the CLI globally:
```bash
npm link
```
Expand All @@ -282,7 +287,7 @@ If you want to customize this tool you can follow these steps:

## Known issues:

Most of the functionalities are just working fine, however, some APIs related to Puter's SDK have some known issues. We tried to fix most of them but some of them are not related to us, so we let you about that in case it'll be fixed by Puter's in the future:
Most features are working fine. If you have any issues with this project or the Puter SDK, please let us know:

## Interactive Shell prompt:
If you want to stay in the interactive shell you should provide "-f" (aka: force delete) argument, when want to delete any object:
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"commander": "^13.0.0",
"conf": "^12.0.0",
"cross-spawn": "^7.0.3",
"dotenv": "^16.4.7",
"glob": "^11.0.0",
"inquirer": "^9.2.12",
"minimatch": "^10.0.1",
Expand Down
15 changes: 15 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 3 additions & 8 deletions src/commands/sites.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,9 @@ export async function infoSite(args = []) {
}

const data = await response.json();
const result = await deleteSubdomain([uuid]);
if (result){
// check if data is empty object
if (Object.keys(data).length === 0){
console.log(chalk.green(`Site ID: "${uuid}" should be deleted.`));
}
}
console.log(chalk.yellow(`Site ID: "${uuid}" may already be deleted!`));
console.log(data);

console.log(chalk.green(`Site ID: "${uuid}" has been deleted.`));
} catch (error) {
console.error(chalk.red('Error deleting site:'), error.message);
return false;
Expand Down
8 changes: 6 additions & 2 deletions src/commons.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ import { formatSize } from './utils.js';
import { readFile } from 'fs/promises';
import { fileURLToPath } from 'url';
import { dirname, join } from 'path';
import dotenv from 'dotenv';

dotenv.config();

export const PROJECT_NAME = 'puter-cli';
export const API_BASE = 'http://api.puter.localhost:4100';
export const BASE_URL = 'http://puter.localhost:4100';
// If you haven't defined your own values in .env file, we'll assume you're running Puter on a local instance:
export const API_BASE = process.env.PUTER_API_BASE || 'http://api.puter.localhost:4100';
export const BASE_URL = process.env.PUTER_BASE_URL || 'http://puter.localhost:4100';

/**
* Get headers with the correct Content-Type for multipart form data.
Expand Down

0 comments on commit ed676dc

Please sign in to comment.