surrealctl
v1.1.1
Published
SurrealDB control center
Downloads
5
Maintainers
Readme
SurrealDB Control Center
A command-line interface for managing SurrealDB instances. This CLI allows you to initialize, start, stop, configure, and check the status of SurrealDB databases.
Features
- Initialize a new SurrealDB database
- Start and stop SurrealDB instances
- Configure database settings
- Check the status of running instances
- Background process management
Installation
Dependency
npm install surrealctl --save-devStandalone / CLI Only
npm install -g surrealctlDevelopment
Clone this repository:
git clone https://github.com/daviddyess/surrealctl.git cd surrealctlInstall dependencies:
npm install
Configuration
The CLI uses a config.json file for configuration. If this file doesn't exist, it will check for the following environment variables:
SURREAL_PATH: The full path to your database file, including the database file with .db extension. This will be created if it doesn't existSURREAL_USER: The username for database accessSURREAL_PASS: The password for database access
Adding these to your environment variables is preferred if you are using the module as a dependency.
You can create a config.json file manually or use the configure command to set these values, if you are using the CLI as a standalone tool.
Configuration File
config.json:
{
"dataDir": "./data",
"username": "root",
"password": "root"
}Commands
init: Initialize a new SurrealDB databasestart: Start a SurrealDB instancestop: Stop the running SurrealDB instanceconfigure: Update configuration settingsstatus: Check the status of the SurrealDB instance
Use npm run help or ./index.js --help for more information on available commands and options.
All commands can be run with npm run if in the surrealctl project directory or directly with npx surrealctl.
Usage
Initialize a new database
npx surrealctl initnpm run initThis command creates a new SurrealDB database using the configured settings.
Start the database
npx surrealctl startnpm startStarts the SurrealDB instance in the background.
Stop the database
npx surrealctl stopnpm stopStops the running SurrealDB instance.
Configure settings
npx configure -- -d ./my-data -u myuser -p mypasswordnpm configure -- -d ./my-data -u myuser -p mypasswordUpdates the configuration with new settings.
Check status
npx surrealctl statusnpm run statusDisplays the current status of the SurrealDB instance.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the Apache 2.0 License - see the LICENSE file for details.
