Skip to content

Commit

Permalink
Pulizia codice (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
Steffo99 authored Sep 27, 2023
1 parent 2ff94bb commit b0c567b
Show file tree
Hide file tree
Showing 15 changed files with 794 additions and 961 deletions.
7 changes: 0 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,3 @@ jobs:
uses: Steffo99/.github/.github/workflows/buildrelease-docker.yml@main
needs:
- test

portainer:
uses: Steffo99/.github/.github/workflows/deploy-portainer.yml@main
needs:
- ghcrio
secrets:
PORTAINER_HOOK_URL: ${{ secrets.PORTAINER_HOOK_URL }}
3 changes: 3 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added .media/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM python:3.10-alpine AS system
FROM python:3.11-alpine AS system
RUN apk add --update --no-cache build-base python3-dev py-pip musl-dev libffi-dev openssl-dev postgresql-dev
RUN pip install --no-cache-dir "poetry==1.3.1"
RUN pip install --no-cache-dir "poetry==1.6.1"

FROM system AS workdir
WORKDIR /usr/src/app
Expand Down
67 changes: 19 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,61 +1,32 @@
# Impressive Strawberry
# ![](.media/icon.png) Impressive Strawberry

_Achievements-as-a-service_
A web API that allowing applications to manage achievements which can be unlocked by their users

## About
## Links

Impressive Strawberry is a Web API that allows the consumer applications to manage user-unlockable achievements, and for external applications to unlock them
for the users, notifying them in the process.
[![PyPI](https://img.shields.io/pypi/v/impressive-strawberry)](https://pypi.org/project/impressive-strawberry/)

[![Website](https://img.shields.io/website?url=https%3A%2F%strawberry.ryg.one%2F)](https://strawberry.ryg.one/)

## Development
## Installation

### Design document
Use the provided Docker image, configuring the following environment variables:

The design document was made [on FigJam](https://www.figma.com/file/8J7exqW3srh0WNiICHnf0O/Medals?node-id=0%3A1).
`IS_DB_URI`
: SQLAlchemy engine URL to use to select the database.

### Documentation
`IS_WEB_HOST`
: Host to bind the webserver to.

Documentation is made available [via GitHub Pages](https://hub.ryg.one/impressive-strawberry/).
`IS_WEB_PORT`
: TCP port to bind the webserver to.

### Tasks
`IS_SECRET`
: Secret used for administration tasks.

Tasks to be done are published [on GitHub Issues](https://github.com/RYGhub/impressive-strawberry/issues).
`CORS_ALLOW_ORIGINS`
: Origins to return in the `Access-Control-Allow-Origins` header.

If you **find a bug**, a **mistake**, or want to **suggest a new feature**,
please [create a new issue](https://github.com/RYGhub/impressive-strawberry/issues/new)!

### Pull requests

Feel free to fork the project and continue developing it, but remember to [respect the AGPL 3.0+ license](LICENSE.txt)!

If you want to contribute back to the main branch, please [open a new pull request](https://github.com/RYGhub/impressive-strawberry/pulls)!

### Discussion

A forum about the project is available [on GitHub Discussions](https://github.com/RYGhub/impressive-strawberry/discussions).

If you want to **talk about the project**, or **ask a question** or even **help**,
please [create a new discussion](https://github.com/RYGhub/impressive-strawberry/discussions/new)!

### CI / CD

CI and CD for this project is hosted [on GitHub Actions](https://github.com/RYGhub/impressive-strawberry/actions).

[![🔨 Steffo's Python Poetry Workflow](https://github.com/RYGhub/impressive-strawberry/actions/workflows/stefflow.yml/badge.svg)](https://github.com/RYGhub/impressive-strawberry/actions/workflows/stefflow.yml)

#### Jobs

- _Tests_ are run **on every push** and **on every pull request**.
- _CodeQL_ is run **every monday at 10:10 AM**.
- _Build and publish_ are run **on every release**.

All jobs can be triggered simultaneously by pressing the **Run Workflow**
button [on the Workflow page](https://github.com/RYGhub/impressive-strawberry/actions/workflows/stefflow.yml).

### Roadmap
## Roadmap

The roadmap is published [on GitHub Projects](https://github.com/orgs/RYGhub/projects/1/views/1).

### Security

Please report security vulnerabilities via email at `[email protected]`.
File renamed without changes.
22 changes: 0 additions & 22 deletions docs/Makefile

This file was deleted.

36 changes: 0 additions & 36 deletions docs/make.bat

This file was deleted.

132 changes: 0 additions & 132 deletions docs/source/conf.py

This file was deleted.

16 changes: 0 additions & 16 deletions docs/source/index.rst

This file was deleted.

1 change: 1 addition & 0 deletions impressive_strawberry/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .logs import install_general_log_handlers
41 changes: 41 additions & 0 deletions impressive_strawberry/utils/logs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import logging
import coloredlogs

this_log = logging.getLogger(__name__)


def install_general_log_handlers():
main_logger: logging.Logger = logging.getLogger("__main__")

interesting_loggers: list[logging.Logger] = [
main_logger,
logging.getLogger("impressive_strawberry"),
]

this_log.debug("Installing console handlers...")
for logger in interesting_loggers:
coloredlogs.install(
logger=logger,
level="DEBUG" if __debug__ else "INFO",
fmt="{asctime} | {name} | {levelname} | {message}",
style="{",
level_styles=dict(
debug=dict(color="white"),
info=dict(color="cyan"),
warning=dict(color="yellow", bold=True),
error=dict(color="red", bold=True),
critical=dict(color="black", background="red", bold=True),
),
field_styles=dict(
asctime=dict(color='magenta'),
levelname=dict(color='blue', bold=True),
name=dict(color='blue'),
),
isatty=True,
)
this_log.debug("Installed console log handler on: %s", logger)


__all__ = (
"install_general_log_handlers",
)
7 changes: 5 additions & 2 deletions impressive_strawberry/web/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
import fastapi.middleware.cors as cors
import uvicorn

logging.basicConfig(level="DEBUG")
from impressive_strawberry.utils import install_general_log_handlers

install_general_log_handlers()

log = logging.getLogger(__name__)

dotenv.load_dotenv(".env", override=True)
Expand All @@ -25,4 +28,4 @@
)
log.info("Running impressive_strawberry with Uvicorn...")
# noinspection PyTypeChecker
uvicorn.run(app, port=int(os.environ["IS_WEB_PORT"]), host=os.environ["IS_WEB_HOST"])
uvicorn.run(app, port=int(os.environ["IS_WEB_PORT"]), host=os.environ["IS_WEB_HOST"], log_config=None)
Loading

0 comments on commit b0c567b

Please sign in to comment.