Skip to content

Commit

Permalink
chg: [configuration] Added default configuration file.
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricbonhomme committed Dec 13, 2023
1 parent 9f2b0ba commit ac045ba
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ security vulnerability. See our
[security policy](https://github.com/scandale-project/pumpkin/security/policy)
page.

[FastAPI](https://flask.palletsprojects.com) is used for the backend API.
[FastAPI](https://fastapi.tiangolo.com/) is used for the backend API.
Please use [black](https://github.com/psf/black) for the syntax of your Python code.


Expand Down
14 changes: 9 additions & 5 deletions api/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker

try:
from instance import config
except Exception:
from instance import example as config

DB_CONFIG_DICT = {
"user": "cedric",
"password": "password",
"host": "localhost",
"port": 5432,
"user": config.DB_USERNAME,
"password": config.DB_PASSWORD,
"host": config.DB_HOST,
"port": config.DB_PORT,
}
DATABASE_NAME = "pumpkin"
DATABASE_NAME = config.DB_NAME
SQLALCHEMY_DATABASE_URI = "postgresql://{user}:{password}@{host}:{port}/{name}".format(
name=DATABASE_NAME, **DB_CONFIG_DICT
)
Expand Down
5 changes: 5 additions & 0 deletions instance/example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DB_USERNAME = "<username>"
DB_PASSWORD = "<password>"
DB_HOST = "localhost"
DB_PORT = 5432
DB_NAME = "pumpkin"

0 comments on commit ac045ba

Please sign in to comment.