https://github.com/douglasmoraisdev/url_regex_validation
A microservice for url validation based on regex whitelist. This python microservice receive and validate regex and urls via RabbitMq Queues, and persists on Mysql Databases. A Docker-compose file is used for orquestration.
https://github.com/douglasmoraisdev/url_regex_validation
Last synced: 2 months ago
JSON representation
A microservice for url validation based on regex whitelist. This python microservice receive and validate regex and urls via RabbitMq Queues, and persists on Mysql Databases. A Docker-compose file is used for orquestration.
- Host: GitHub
- URL: https://github.com/douglasmoraisdev/url_regex_validation
- Owner: douglasmoraisdev
- Created: 2020-03-23T22:02:16.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-03-23T22:56:37.000Z (about 6 years ago)
- Last Synced: 2025-01-15T07:38:28.416Z (over 1 year ago)
- Language: Python
- Size: 21.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Url Regex Validator
A microservice for url validation based on regex whitelist. This python microservice receive and validate regex and urls via RabbitMq Queues, and persists on Mysql Databases. A Docker-compose file is used for orquestration.
# Running service
> $ docker-compose up
# Running unit tests
Using Docker
> $ docker exec -it python -m unittest
Standalone service
> $ python -m unittest
# Configuration
Use these files for configuration:
When running with docker-compose (default)
> src/.docker.env
When running only the microservice (external Mysql and/or Rabbitmq)
> src/.env
To configure automated tests env variables
> src/tests/.env
# Inserting new regex on Whitelist
Post this payload on RabbitMQ. Queue: $INSERTION_QUEUE (.env):
```json
{"client": , "regex": }
```
```client```
A client name (string), if 'null', will be saved on 'global' whitelist
```regex```
A url format regex for whitelist
# Validating Urls
Post this payload on RabbitMQ. Queue: $VALIDATION_QUEUE (.env):
```json
{"client": , "url": , "correlationId": }
```
```client:```
A client name (string), if 'null', will be match on 'global' whitelist
```url:```
A url for validation
```correlationId:```
A UUID for relation queries and responses
# Validating results (Response)
This payload will be post on RabbitMQ response routing key ($RESPONSE_ROUTING_KEY), when a validating occured.
```json
{"match": , "regex": , "correlationId": }
```
```match:```
Result of whitelist validation: true or false
```regex:```
The matched regex. If no match found will be 'null'
```correlationId:```
The correlationId origin of validation