-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
114 lines (83 loc) · 2.7 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
from typing import Literal
from pydantic import BaseSettings
# CHANGE
class ServerSettings(BaseSettings):
HOST: str = "0.0.0.0"
PORT: int = 8000
LOG_LEVEL: str = "info"
class Config:
orm_mode = True
# CHANGE
class DatabaseSettings(BaseSettings):
DB_NAME: str = "portfolio"
DB_URI: str = "MONGODB_URI"
PORT: int = 27017
class Config:
orm_mode = True
# CHANGE
class MiddlewareSettings(BaseSettings):
CORS_CRED: bool = True
CORS_METHODS: list = ["*"]
CORS_HEADERS: list = ["*"]
CORS_ORIGINS: list = [
"http://pochetes.herokuapp.com/personal",
"http://pochetes.herokuapp.com/experiences",
"http://pochetes.herokuapp.com/projects",
"https://pochetes.herokuapp.com/personal",
"https://pochetes.herokuapp.com/experiences",
"https://pochetes.herokuapp.com/projects",
"http://localhost",
"http://localhost:8000",
"http://localhost:8000/personal",
"http://localhost:8000/experiences",
"http://localhost:8000/projects",
]
class Config:
orm_mode = True
# CHANGE
class MetadataSettings(BaseSettings):
APP_NAME: str = "Roberto's Portfolio API"
DEBUG_MODE: bool = True
VERSION: str = "1.0.0"
CONTACT: dict = {
"name": "Roberto Martinez",
"email": "robertomiguel2001@gmail.com"
}
LICENSE: dict = {
"name": "MIT",
"url": "https://choosealicense.com/licenses/mit"
}
DESC: str = """
This is an API that retrieves information about Roberto Martinez's personal and work life. 🚀
For now, we have 5 broad endpoints that describe everything there is to know. However, some of the
endpoint methods will be unavailable to users as they are authenticated for my use only.
### User 👨🏼
You will be able to see my:
* name.
* email.
* brief description.
### Contacts 📲
Here will be my **social media** links.
### Skills 🌟
This section holds the **technical** skills that I possess.
### Experiences 📈
Here will be the experiences that I've had throughout my journey pursuing **Software Engineering**.
### Interests 🤔
This will retrieve my interests **in** and **outside** the technology world.
### Projects 💡
This will return my software related projects that I have worked on.
"""
class Config:
orm_mode = True
# container class for all settings
class Settings(BaseSettings):
db: DatabaseSettings
md: MiddlewareSettings
mt: MetadataSettings
srv: ServerSettings
class Config:
orm_mode: Literal[True]
settings = Settings(db=DatabaseSettings(),
md=MiddlewareSettings(),
mt=MetadataSettings(),
srv=ServerSettings())