Functionality
-
Displaying Computer Information: The main page of the web service displays information about the current computer, including its hostname and platform, making it easy for users to identify the machine they are working on.
-
Disk Information: The web service also provides information about the disks on the computer. This includes the path to each disk, free space, total size, and usage percentage. This information can be useful for monitoring available disk space and identifying potential disk space usage issues.
-
Saving Disk Information: By sending a request to the /save-info
path, users can save disk information on their computer to a SQLite database with the current date. This can be valuable for analyzing changes in disk space usage over time.
-
Viewing Saved Disk Information: When accessing the /disk
path, the web service allows users to view the previously saved disk information using /save-info
.
-
Protection with HTTP Authentication: Access to the /save-info
and /disk
paths is restricted with HTTP authentication using Basic Auth. This provides protection for the saved disk information from unauthorized access.
Description
go-pc-info is a web service built in Go that provides information about the computer it is running on. This convenient tool allows users to quickly access key characteristics of their computer, such as hostname, platform, and disk information. The service has a user-friendly interface and is easy to use.
Features
-
Clean Architecture: The project follows the clean architecture, making it more flexible and easily adaptable to future changes. The architectural style promotes easy testing and ensures well-structured code.
-
Functional Tests: Functional tests are included, enabling the verification of whether the web service works correctly and meets requirements.
-
Gin Router: The popular and fast Gin router is used for handling routes and requests. This provides high performance and reliability for the web service.
-
Koanf for Configuration Reading: The web service uses the Koanf library for convenient reading and management of configuration files. This allows easy customization of web service parameters without modifying the source code.
-
Zap Logger: The Zap library is used for logging important events and errors. This helps track the web service's operation and quickly identify potential issues.
-
GitHub Actions: The web service is configured for automation using GitHub Actions. This includes running Go unit tests to ensure code quality, static code analysis with GolangCI-Lint, and automatic deployment to a remote server after successfully passing all checks.
Installation and Running
- Clone the repository:
git clone https://github.com/korovindenis/go-pc-info.git
cd go-pc-info
- Build app:
make
- Start the web server:
GoPcInfo
or install as service:
make install
The web server will be available at http://localhost:8082/
.
Setting up HTTP Authentication
To set up HTTP authentication for the /save-info
and /disk
paths, edit user
in config.prod.yaml
and create a env PC_INFO_PASSWORD
.
License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Contributions and Feedback
If you find any issues, have suggestions, or would like to contribute to the project, feel free to create an Issue or Pull Request. We value your contributions and aim to make the project even better.
Thank you for using go-pc-info! We hope this service helps you easily access information about your computer.