updated Empty Runner
This commit is contained in:
116
Configs/api.py
Normal file
116
Configs/api.py
Normal file
@@ -0,0 +1,116 @@
|
||||
import datetime
|
||||
|
||||
class DefaultApiConfig:
|
||||
app: str
|
||||
host: str
|
||||
port: int
|
||||
log_level: str
|
||||
reload: bool
|
||||
|
||||
@classmethod
|
||||
def as_dict(cls):
|
||||
return {
|
||||
"app": cls.app,
|
||||
"host": cls.host,
|
||||
"port": int(cls.port),
|
||||
"log_level": cls.log_level,
|
||||
"reload": bool(cls.reload),
|
||||
}
|
||||
|
||||
|
||||
|
||||
class ApiConfigs:
|
||||
"""Base class for all configurations."""
|
||||
|
||||
SECRET: str = "59f871a2d2194e96adb36b279d2cc21059f871a2d2194e96adb36b279d2cc21059f871a2d2194e96adb36b279d2cc210s"
|
||||
ACCESS_TIME: int = 432000
|
||||
REFRESH_TIME: int = 864000
|
||||
DEFAULT_SIZE: int = 10
|
||||
MIN_SIZE: int = 5
|
||||
MAX_SIZE: int = 50
|
||||
ACCESS_TOKEN_TAG: str = "Authorization"
|
||||
REFRESH_TOKEN_TAG: str = "Refresher"
|
||||
ACCESS_TOKEN_LENGTH: int = 72
|
||||
REFRESH_TOKEN_LENGTH: int = 128
|
||||
|
||||
|
||||
class ApiStatic:
|
||||
PLACEHOLDER = "https://s.tmimgcdn.com/scr/800x500/276800/building-home-nature-logo-vector-template-3_276851-original.jpg"
|
||||
FORGOT_LINK = "https://www.evyos.com.tr/password/create?tokenUrl="
|
||||
BLACKLIST_LINK = "https://www.evyos.com.tr/support/unknown-login-notice/"
|
||||
APP_DIR = "/home/berkay/git-evyos/api-managment-backend/"
|
||||
|
||||
@classmethod
|
||||
def forgot_link(cls, forgot_key):
|
||||
return cls.FORGOT_LINK + forgot_key
|
||||
|
||||
@classmethod
|
||||
def blacklist_login(cls, record_id):
|
||||
return cls.BLACKLIST_LINK + record_id
|
||||
|
||||
|
||||
class MainConfig:
|
||||
|
||||
# Date and Time Configuration
|
||||
DATETIME_FORMAT = "YYYY-MM-DD HH:mm:ss Z"
|
||||
DATETIME_FORMAT_JS = "YYYY-MM-DD HH:mm:ss +0"
|
||||
|
||||
# Timezone Configuration
|
||||
DEFAULT_TIMEZONE = "GMT+3" # Default timezone for the application
|
||||
SYSTEM_TIMEZONE = "GMT+0" # System timezone (used for internal operations)
|
||||
SUPPORTED_TIMEZONES = ["GMT+0", "GMT+3"] # List of supported timezones
|
||||
|
||||
|
||||
class LanguageConfig:
|
||||
|
||||
SUPPORTED_LANGUAGES = ["en", "tr"]
|
||||
DEFAULT_LANGUAGE = "tr"
|
||||
|
||||
|
||||
class ValidationsConfig:
|
||||
|
||||
SUPPORTED_VALIDATIONS = ["header", "validation", "all"]
|
||||
DEFAULT_VALIDATION = "all"
|
||||
|
||||
|
||||
class ApiConfig(DefaultApiConfig):
|
||||
# Application Information
|
||||
APP_NAME = "evyos-auth-api-gateway"
|
||||
TITLE = "WAG API Auth Api Gateway"
|
||||
DESCRIPTION = (
|
||||
"This api is serves as web auth api gateway only to evyos web services."
|
||||
)
|
||||
APP_URL = "https://www.auth.eys.gen.tr"
|
||||
|
||||
# Server Configuration
|
||||
app = "app:app"
|
||||
host = "0.0.0.0"
|
||||
port = 41575
|
||||
log_level = "info"
|
||||
reload = True
|
||||
|
||||
|
||||
class Auth:
|
||||
ACCESS_EMAIL_EXT = "evyos.com.tr"
|
||||
ACCESS_TOKEN_TAG = "evyos-session-key"
|
||||
REFRESHER_TOKEN_TAG = "eys-session-refresher"
|
||||
SECRET_KEY_72 = (
|
||||
"t3sUAmjTGeTgDc6dAUrB41u2SNg0ZHzj4HTjem95y3fRH1nZXOHIBj163kib6iLybT0gLaxq"
|
||||
)
|
||||
SECRET_KEY_96 = "7ct8VpiwaP1hR2bVSet4dEEAgepuTZUOnO1QxOgKyDqBR2PkqNhcubSrbUUigQKoQA1PBoeeQn5ZCo24pESmVtKs76nA4EKq"
|
||||
SECRET_KEY_144 = (
|
||||
"R2p5Rq6KCr6PCfjFYUeH1keF2VWHFEuqINVjBGGnvRA2m10pYUKqfOtIGBcaj2v5wZmElDndzSHGOS7roQsoTelPSok0"
|
||||
+ "qqMucurMWE0FGexGpFuJkfPEm9tH2OjMOqegvEetpSVywH0W4Kh4"
|
||||
)
|
||||
|
||||
ALGORITHM = "HS256"
|
||||
ACCESS_TOKEN_LENGTH: int = 90
|
||||
REFRESHER_TOKEN_LENGTH: int = 144
|
||||
PASSWORD_EXPIRE_DAY = datetime.timedelta(days=30)
|
||||
TOKEN_EXPIRE_MINUTES_1 = datetime.timedelta(minutes=1)
|
||||
TOKEN_EXPIRE_MINUTES_15 = datetime.timedelta(minutes=15)
|
||||
TOKEN_EXPIRE_MINUTES_30 = datetime.timedelta(minutes=30)
|
||||
TOKEN_EXPIRE_DAY_1 = datetime.timedelta(days=1)
|
||||
TOKEN_EXPIRE_DAY_5 = datetime.timedelta(days=5)
|
||||
TOKEN_EXPIRE_DAY_15 = datetime.timedelta(days=15)
|
||||
TOKEN_EXPIRE_DAY_30 = datetime.timedelta(days=30)
|
||||
34
Configs/host_config.py
Normal file
34
Configs/host_config.py
Normal file
@@ -0,0 +1,34 @@
|
||||
|
||||
|
||||
class HostConfig:
|
||||
|
||||
MAIN_HOST: str = "10.10.2.36" # http://10.10.2.36
|
||||
EMAIL_HOST: str = "10.10.2.34" # http://10.10.2.34
|
||||
|
||||
|
||||
class MainConfig:
|
||||
|
||||
APP_NAME: str = "evyos-web-api-gateway"
|
||||
TITLE: str = "WAG API Web Api Gateway"
|
||||
DESCRIPTION: str = "This api is serves as web api gateway only to evyos web services."
|
||||
APP_URL: str = "https://www.wag.eys.gen.tr"
|
||||
|
||||
DATETIME_FORMAT: str = "YYYY-MM-DD HH:mm:ss ZZ"
|
||||
DATETIME_FORMAT_JS: str = "YYYY-MM-DD HH:mm:ss +0"
|
||||
|
||||
# Timezone Configuration
|
||||
DEFAULT_TIMEZONE: str = "GMT+3" # Default timezone for the application
|
||||
SYSTEM_TIMEZONE: str = "GMT+0" # System timezone (used for internal operations)
|
||||
SUPPORTED_TIMEZONES: list = ["GMT+0", "GMT+3"] # List of supported timezones
|
||||
|
||||
|
||||
class LanguageConfig:
|
||||
|
||||
SUPPORTED_LANGUAGES: list = ["en", "tr"]
|
||||
DEFAULT_LANGUAGE: str = "tr"
|
||||
|
||||
|
||||
class ValidationsConfig:
|
||||
|
||||
SUPPORTED_VALIDATIONS: list = ["header", "validation", "all"]
|
||||
DEFAULT_VALIDATION: str = "all"
|
||||
10
Configs/mongo.py
Normal file
10
Configs/mongo.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from Configs.host_config import HostConfig
|
||||
|
||||
|
||||
class MongoConfig:
|
||||
PASSWORD: str = "mongo_password"
|
||||
USER_NAME: str = "mongo_user"
|
||||
DATABASE_NAME: str = "mongo_database"
|
||||
HOST: str = HostConfig.MAIN_HOST
|
||||
PORT: str = 11777
|
||||
URL: str = f"mongodb://{USER_NAME}:{PASSWORD}@{HOST}:{PORT}/{DATABASE_NAME}?retryWrites=true&w=majority"
|
||||
17
Configs/postgres.py
Normal file
17
Configs/postgres.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from Configs.host_config import HostConfig
|
||||
|
||||
|
||||
class Database:
|
||||
HOST: str = HostConfig.MAIN_HOST
|
||||
PORT: str = "5444"
|
||||
SQL: str = "postgresql+psycopg2"
|
||||
USERNAME: str = "berkay_wag_user"
|
||||
PASSWORD: str = "berkay_wag_user_password"
|
||||
DATABASE_NAME: str = "wag_database"
|
||||
DATABASE_URL: str = f"{SQL}://{USERNAME}:{PASSWORD}@{HOST}:{PORT}/{DATABASE_NAME}"
|
||||
|
||||
|
||||
class PaginateConfig:
|
||||
DEFAULT_SIZE = 10
|
||||
MIN_SIZE = 10
|
||||
MAX_SIZE = 50
|
||||
121
Configs/redis.py
Normal file
121
Configs/redis.py
Normal file
@@ -0,0 +1,121 @@
|
||||
from Configs.host_config import HostConfig
|
||||
|
||||
|
||||
class WagRedis:
|
||||
|
||||
REDIS_HOST = HostConfig.MAIN_HOST
|
||||
REDIS_PASSWORD: str = "commercial_redis_password"
|
||||
REDIS_PORT: int = 11222
|
||||
REDIS_DB: int = 0
|
||||
|
||||
@classmethod
|
||||
def as_dict(cls):
|
||||
return dict(
|
||||
host=WagRedis.REDIS_HOST,
|
||||
password=WagRedis.REDIS_PASSWORD,
|
||||
port=WagRedis.REDIS_PORT,
|
||||
db=WagRedis.REDIS_DB,
|
||||
)
|
||||
|
||||
|
||||
class RedisValidationKeys:
|
||||
ENDPOINTS: str = "ENDPOINTS"
|
||||
VALIDATIONS: str = "VALIDATIONS"
|
||||
HEADERS: str = "HEADERS"
|
||||
ERRORCODES: str = "ERRORCODES"
|
||||
RESPONSES: str = "RESPONSES"
|
||||
REQUESTS: str = "REQUESTS"
|
||||
RESPONSE: str = "RESPONSE"
|
||||
LANGUAGE_MODELS: str = "LANGUAGE_MODELS"
|
||||
STATIC: str = "STATIC"
|
||||
DYNAMIC: str = "DYNAMIC"
|
||||
# REQUEST: str = "REQUEST"
|
||||
# VALIDATION_USER: str = "VALIDATION_USER"
|
||||
|
||||
|
||||
class RedisAuthKeys:
|
||||
AUTH: str = "AUTH"
|
||||
OCCUPANT: str = "OCCUPANT"
|
||||
EMPLOYEE: str = "EMPLOYEE"
|
||||
CACHE: str = "CACHE"
|
||||
|
||||
|
||||
class RedisCategoryKeys:
|
||||
REBUILD: str = "REBUILD"
|
||||
ENDPOINT2CLASS: str = "ENDPOINT2CLASS"
|
||||
CLUSTER_INDEX: str = "CLUSTER_INDEX"
|
||||
CLUSTER_FUNCTION_CODES: str = "CLUSTER_FUNCTION_CODES"
|
||||
METHOD_FUNCTION_CODES: str = "METHOD_FUNCTION_CODES"
|
||||
MENU_FIRST_LAYER: str = "MENU_FIRST_LAYER"
|
||||
PAGE_MAPPER: str = "PAGE_MAPPER"
|
||||
MENU_MAPPER: str = "MENU_MAPPER"
|
||||
|
||||
|
||||
class RedisCategoryPageInfoKeys:
|
||||
"""
|
||||
### /create?site=BuildingCluster, #/update?site=BuildingCluster, #/dashboard?site=BuildingCluster
|
||||
PAGE_URL: /dashboard?site=BuildingCluster
|
||||
PAGE_NAME: BuildingCluster
|
||||
PAGE_INFO: {LANGUAGE_MODELS: "", ICON: "", URL: ""}
|
||||
PAGE_MENU_INDEX: 1 # {build_living_space: "uuid4", LAYER: 1, MENU_INDEX: 1}
|
||||
|
||||
PAGE_MENU_COMPONENT: {..., lang: {"tr"}: {...}, lang: {"en"}: {...}}
|
||||
PAGE_LANGUAGE: {{"tr"}: {...},{"en"}: {...}}
|
||||
"""
|
||||
|
||||
PAGE_URL: str = "PAGE_URL"
|
||||
PAGE_NAME: str = "PAGE_NAME"
|
||||
PAGE_INFO: str = "PAGE_INFO"
|
||||
PAGE_COMPONENT: str = "PAGE_COMPONENT"
|
||||
PAGE_MENU_INDEX: str = "PAGE_MENU_INDEX"
|
||||
PAGE_MENU_COMPONENT: str = "PAGE_MENU_COMPONENT"
|
||||
PAGE_LANGUAGE: str = "PAGE_LANGUAGE"
|
||||
|
||||
|
||||
class RedisCategoryPageInfoKeysAction:
|
||||
"""
|
||||
PAGE_MAPPER: {PAGE_URL: /dashboard?site=BuildingCluster, PAGE_NAME: BuildingCluster, PAGE_INFO: {LANGUAGE_MODELS: "", ICON: "", URL: ""}}
|
||||
value : {RedisCategoryPageInfoKeys.PAGE_INFO}
|
||||
MENU_MAPPER: {PAGE_MENU_INDEX: 1, PAGE_MENU_COMPONENT: {..., lang: {"tr"}: {...}, lang: {"en"}: {...}}}
|
||||
value : {RedisCategoryPageInfoKeys.PAGE_INFO}
|
||||
"""
|
||||
|
||||
page_index: str = (
|
||||
f"{RedisCategoryPageInfoKeys.PAGE_MENU_INDEX}:{RedisCategoryPageInfoKeys.PAGE_URL}"
|
||||
)
|
||||
page_mapper_key_language: str = (
|
||||
f"{RedisCategoryPageInfoKeys.PAGE_MENU_INDEX}:{RedisCategoryPageInfoKeys.PAGE_LANGUAGE}"
|
||||
)
|
||||
menu_mapper_key: str = (
|
||||
f"{RedisCategoryPageInfoKeys.PAGE_URL}:{RedisCategoryPageInfoKeys.PAGE_MENU_INDEX}"
|
||||
)
|
||||
menu_mapper_key_component: str = (
|
||||
f"{RedisCategoryPageInfoKeys.PAGE_URL}:{RedisCategoryPageInfoKeys.PAGE_MENU_COMPONENT}"
|
||||
)
|
||||
|
||||
|
||||
class RedisValidationKeysAction:
|
||||
# LANGUAGE_MODELS:DYNAMIC:VALIDATIONS:
|
||||
dynamic_validation_key: str = (
|
||||
f"{RedisValidationKeys.LANGUAGE_MODELS}:{RedisValidationKeys.DYNAMIC}:{RedisValidationKeys.VALIDATIONS}"
|
||||
)
|
||||
# LANGUAGE_MODELS:DYNAMIC:HEADERS:REQUEST
|
||||
dynamic_header_request_key: str = (
|
||||
f"{RedisValidationKeys.LANGUAGE_MODELS}:{RedisValidationKeys.DYNAMIC}:{RedisValidationKeys.HEADERS}:{RedisValidationKeys.REQUESTS}"
|
||||
)
|
||||
# LANGUAGE_MODELS:DYNAMIC:HEADERS:RESPONSE
|
||||
dynamic_header_response_key: str = (
|
||||
f"{RedisValidationKeys.LANGUAGE_MODELS}:{RedisValidationKeys.DYNAMIC}:{RedisValidationKeys.HEADERS}:{RedisValidationKeys.RESPONSES}"
|
||||
)
|
||||
# LANGUAGE_MODELS:STATIC:ERRORCODES:
|
||||
static_error_code_key: str = (
|
||||
f"{RedisValidationKeys.LANGUAGE_MODELS}:{RedisValidationKeys.STATIC}:{RedisValidationKeys.ERRORCODES}"
|
||||
)
|
||||
# LANGUAGE_MODELS:STATIC:RESPONSES:
|
||||
static_response_key: str = (
|
||||
f"{RedisValidationKeys.LANGUAGE_MODELS}:{RedisValidationKeys.STATIC}:{RedisValidationKeys.RESPONSES}"
|
||||
)
|
||||
# LANGUAGE_MODELS:STATIC:REQUESTS:
|
||||
static_request_key: str = (
|
||||
f"{RedisValidationKeys.LANGUAGE_MODELS}:{RedisValidationKeys.STATIC}:{RedisValidationKeys.REQUESTS}"
|
||||
)
|
||||
Reference in New Issue
Block a user