nlbone 0.3.1__py3-none-any.whl → 0.3.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
nlbone/config/settings.py CHANGED
@@ -26,6 +26,7 @@ class Settings(BaseSettings):
26
26
  # ---------------------------
27
27
  # App
28
28
  # ---------------------------
29
+ PORT: int = 8000
29
30
  ENV: Literal["local", "dev", "staging", "prod"] = Field(default="local")
30
31
  DEBUG: bool = Field(default=False)
31
32
  LOG_LEVEL: Literal["CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG"] = Field(default="INFO")
@@ -53,7 +54,8 @@ class Settings(BaseSettings):
53
54
  # ---------------------------
54
55
  # Database
55
56
  # ---------------------------
56
- POSTGRES_DB_DSN: str = Field(default="postgresql+asyncpg://user:pass@localhost:5432/nlbone")
57
+ POSTGRES_DB_DSN: str = Field(default="postgresql+asyncpg://user:pass@localhost:5432/nlbone", validation_alias=AliasChoices("NLBONE_POSTGRES_DB_DSN",
58
+ "POSTGRES_DB_DSN", "DATABASE_URL", "DB_DSN"))
57
59
 
58
60
  # ---------------------------
59
61
  # Messaging / Cache
@@ -76,6 +78,10 @@ class Settings(BaseSettings):
76
78
  extra="ignore",
77
79
  )
78
80
 
81
+ @classmethod
82
+ def load(cls, env_file: str | None = None) -> "Settings":
83
+ return cls(_env_file=env_file or _guess_env_file())
84
+
79
85
 
80
86
  @lru_cache(maxsize=4)
81
87
  def get_settings(env_file: str | None = None) -> Settings:
@@ -85,5 +91,4 @@ def get_settings(env_file: str | None = None) -> Settings:
85
91
  from nlbone.config.settings import get_settings
86
92
  settings = get_settings()
87
93
  """
88
- env_file = env_file or _guess_env_file()
89
- return Settings(_env_file=env_file)
94
+ return Settings.load(env_file)
@@ -1 +1,2 @@
1
- from .db import get_session, get_async_session
1
+ from .db import get_session, get_async_session
2
+ from .auth import has_access, client_has_access, current_client_id, current_user_id, current_request, user_authenticated
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nlbone
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: Backbone package for interfaces and infrastructure in Python projects
5
5
  Author-email: Amir Hosein Kahkbazzadeh <a.khakbazzadeh@gmail.com>
6
6
  License: MIT
@@ -20,7 +20,7 @@ nlbone/adapters/messaging/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJW
20
20
  nlbone/adapters/messaging/redis.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
21
  nlbone/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
22
  nlbone/config/logging.py,sha256=68WRQejEpL6eHEY_cOgdlOjndKc-RWth0n4YmXnceC8,5041
23
- nlbone/config/settings.py,sha256=2PEGXJwmhjHK9wuX2AKCfPZWz3F1dvJ5ig4Sad7jqlc,3274
23
+ nlbone/config/settings.py,sha256=f-wbPwtia09yxiDY6u1W7JefBAinJPRjTHi5UCw_psU,3563
24
24
  nlbone/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
25
  nlbone/core/application/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
26
  nlbone/core/application/services.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -41,7 +41,7 @@ nlbone/interfaces/api/exception_handlers.py,sha256=Z3_dTGAmpHfgaMe_HTW89OpRtq-aa
41
41
  nlbone/interfaces/api/exceptions.py,sha256=uJWNEu5-cgoMedYebNHuIFJioXl_fnBhO89E6FINT2A,2259
42
42
  nlbone/interfaces/api/routers.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
43
43
  nlbone/interfaces/api/schemas.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
44
- nlbone/interfaces/api/dependencies/__init__.py,sha256=XrTGkHS8xqryfyr8XSm_s9sIzp4E0b44XQ40sVWcKMY,46
44
+ nlbone/interfaces/api/dependencies/__init__.py,sha256=V9Nf0JcQkJ0FjBYDRyQsJcLQUejZ2pSmmn05hdKgK1Y,167
45
45
  nlbone/interfaces/api/dependencies/auth.py,sha256=GHUlZ5L2N6ilOaOJqRicHrORB3AD3z2Y-qrO9Q2dNr4,1774
46
46
  nlbone/interfaces/api/dependencies/db.py,sha256=IqDVq1lcCCxd22FBUg523lVANM_j71BYAQtsbrHc4M8,465
47
47
  nlbone/interfaces/api/middleware/__init__.py,sha256=Xcxg9Oy8uToPXaTSdBTKhst-hZwsaIEhqxx4mmo1bZI,157
@@ -58,7 +58,7 @@ nlbone/interfaces/jobs/sync_tokens.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJW
58
58
  nlbone/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
59
59
  nlbone/utils/context.py,sha256=AUiN1jM0ebNMopZQoJSqWTfUHuVrp-HV8x6g7QsbEJ8,1601
60
60
  nlbone/utils/time.py,sha256=dC0ucyAmHdNf3wpA_JPinl2VJRubWqx2vcRpJsT3-0k,102
61
- nlbone-0.3.1.dist-info/METADATA,sha256=WJBTZ953uoswagIj1JRD-iZnykfYhQqjEFRogKc56ZU,2298
62
- nlbone-0.3.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
63
- nlbone-0.3.1.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
64
- nlbone-0.3.1.dist-info/RECORD,,
61
+ nlbone-0.3.2.dist-info/METADATA,sha256=5rsqIn8P0PDRG4fpM2foF_7F0NCTE8lciIDu1H8YxLs,2298
62
+ nlbone-0.3.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
63
+ nlbone-0.3.2.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
64
+ nlbone-0.3.2.dist-info/RECORD,,
File without changes