Update README.md

This commit is contained in:
Chigozirim Igweamaka 2024-08-06 07:51:50 +01:00 committed by GitHub
parent 45fa3da74c
commit c727bd7b7b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -22,7 +22,6 @@ Additionally, it currently only supports song files in WAV format.
### Prerequisites ### Prerequisites
- Golang: [Install Golang](https://golang.org/dl/) - Golang: [Install Golang](https://golang.org/dl/)
- FFmpeg: [Install FFmpeg](https://ffmpeg.org/download.html) - FFmpeg: [Install FFmpeg](https://ffmpeg.org/download.html)
- MongoDB: [Install MongoDB](https://www.mongodb.com/docs/manual/installation/)
- NPM: To run the client (frontend). - NPM: To run the client (frontend).
### Steps ### Steps
@ -74,19 +73,24 @@ go run *.go find <path-to-wav-file>
``` ```
go run *.go erase go run *.go erase
``` ```
#### ▸ Setup MongoDB 🍃
SQLite is used as the default database; however, you can switch to MongoDB if desired. ### Database Options
To configure the database connection for MongoDB, set the following environment variables: This application uses SQLite as the default database, but you can switch to MongoDB if preferred.
- `DB_TYPE` = `"mongo"`
- `DB_USER`: The username for the MongoDB database.
- `DB_PASS`: The password for the MongoDB database.
- `DB_NAME`: The name of the MongoDB database.
- `DB_HOST`: The host address of the MongoDB database.
- `DB_PORT`: The port number of the MongoDB database.
The database connection URI is constructed using the environment variables. #### Using MongoDB
If the `DB_USER` or `DB_PASS` environment variables are not set, it defaults to connecting to `mongodb://localhost:27017`. 1. [Install MongoDB](https://www.mongodb.com/docs/manual/installation/)
2. Configure MongoDB Connection:
To connect to your MongoDB instance, set the following environment variables:
* `DB_TYPE`: Set this to "mongo" to indicate using MongoDB.
* `DB_USER`: The username for your MongoDB database.
* `DB_PASS`: The password for your MongoDB database.
* `DB_NAME`: The name of the MongoDB database you want to use.
* `DB_HOST`: The hostname or IP address of your MongoDB server.
* `DB_PORT`: The port number on which your MongoDB server is listening.
**Note:** The database connection URI is constructed using the environment variables.
If the `DB_USER` or `DB_PASS` environment variables are not set, it defaults to connecting to `mongodb://localhost:27017`.
## Example :film_projector: ## Example :film_projector:
Download a song Download a song
@ -135,10 +139,6 @@ Final prediction: Voilà by André Rieu , score: 5390686.00
- [Creating Shazam in Java](https://www.royvanrijn.com/blog/2010/06/creating-shazam-in-java/) - [Creating Shazam in Java](https://www.royvanrijn.com/blog/2010/06/creating-shazam-in-java/)
## Todo
- [x] Implement saving local songs to DB
- [ ] Add support for file-based DB as an alternative to MongoDB.
## Author :black_nib: ## Author :black_nib:
- Chigozirim Igweamaka - Chigozirim Igweamaka
- Check out my other [GitHub](https://github.com/cgzirim) projects. - Check out my other [GitHub](https://github.com/cgzirim) projects.