Commit 7f84ab96 authored by deepdey's avatar deepdey

chore: update config and doc

parent 10b98f4f
......@@ -11,4 +11,4 @@ docs/_build/
*.log
docker-compose.yml
*.tar.gz
.env
\ No newline at end of file
.env*
\ No newline at end of file
......@@ -4,9 +4,53 @@ Flask app to implement auth flow for Webomagic application
Purpose of the application is to restrict api depending on user roles and their privilages.
- The type convention for endpoints to be followed:
- `P` : `PUBLIC` - No need to login
- `V` : `PRIVATE` - Need to login but no role check
- `SU` : ``SUPER USER`` - Only accessable by `super users`
- `PA` : `PROJECT ADMIN` - Only accesable by `project admins or above users`.
- `RA` : `ROLE BASE AUTH` - Only accesable by `privilaged user and PA/SU`.
### Conventions for API Tags
***
- `P` : `PUBLIC` - No need to login
- `V` : `PRIVATE` - Need to login but no role check
- `SU` : ``SUPER USER`` - Only accessable by `super users`
- `PA` : `PROJECT ADMIN` - Only accesable by `project admins or above users`.
- `RA` : `ROLE BASE AUTH` - Only accesable by `privilaged user and PA/SU`.
### Installation
***
- To run the application you can create virtual environment andor directly install requirements in it.
```bash
pip3 install -r requirements.txt
```
- Create database schema and insert data by running scripts `database\schema.sql` and `database\query.sql`
- Create a `.env` file and add following values in it.
```bash
FLASK_APP=main.py
FLASK_ENV=development
FLASK_DEBUG=1
SERVER_HOST=127.0.0.1
SERVER_PORT=5010
POSTGRES_USER=postgres
POSTGRES_DB=user_db
POSTGRES_HOST=127.0.0.1
POSTGRES_PASSWORD=2580
REDIS_HOST=127.0.0.1
REDIS_PORT=6379
REDIS_DATABASE=0
LOGGER_PATH=D:/WEBSOFTTECHS/webomagic/Webomagic-User/logs
```
- Run the application
```bash
python main.py
```
- Open `http://<your-host>:<your-port>/webomagic-user/v1/swagger-ui` in browser.
\ No newline at end of file
......@@ -10,10 +10,10 @@ SERVER_HOST: str = os.environ.get('SERVER_HOST', '0.0.0.0')
SERVER_PORT: str = os.environ.get('SERVER_PORT', '5011')
POSTGRES: dict = {
'user': os.environ.get('POSTGRES_USER', 'webomagic_python_da'),
'user': os.environ.get('POSTGRES_USER', ''),
'db': os.environ.get('POSTGRES_DB', 'user_db'),
'host': os.environ.get('POSTGRES_HOST', '127.0.0.1'),
'password': urllib.parse.quote(os.environ.get('POSTGRES_PASSWORD', 'P@$$w0rdIITKGP')),
'password': urllib.parse.quote(os.environ.get('POSTGRES_PASSWORD', '')),
'port': os.environ.get('POSTGRES_PORT', '5432')
}
DB_URI: str = 'postgresql://%(user)s:%(password)s@%(host)s:%(port)s/%(db)s' % POSTGRES
......@@ -25,7 +25,7 @@ REDIS_PORT = os.environ.get('REDIS_PORT', 6379)
REDIS_DATABASE = os.environ.get('REDIS_DATABASE', 0)
LOGGER_PATH: str = os.environ.get('LOGGER_PATH', f'/etc/webomagic_user/logs/')
LOGGER_PATH: str = os.environ.get('LOGGER_PATH', f'{os.getcwd()}{os.sep}logs{os.sep}')
print(LOGGER_PATH)
def get_logger(__name__: str) -> logging.Logger:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment