33from enum import Enum
44from typing import Dict , List , Optional
55
6- import pydantic
6+ from pydantic_settings import BaseSettings
77
88
99class functionName (str , Enum ):
@@ -14,24 +14,24 @@ class functionName(str, Enum):
1414 vector = "vector"
1515
1616
17- class eoAPISettings (pydantic . BaseSettings ):
17+ class eoAPISettings (BaseSettings ):
1818 """Application settings"""
1919
2020 name : str = "eoapi"
2121 stage : str = "production"
22- owner : Optional [str ]
23- client : Optional [str ]
22+ owner : Optional [str ] = None
23+ client : Optional [str ] = None
2424 functions : List [functionName ] = [functionName .stac , functionName .raster ]
2525
26- class Config :
27- """model config"""
28-
29- env_file = ".env"
30- env_prefix = "CDK_EOAPI_"
31- use_enum_values = True
26+ model_config = {
27+ "env_prefix" : "CDK_EOAPI_" ,
28+ "env_file" : ".env" ,
29+ "extra" : "ignore" ,
30+ "use_enum_values" : True ,
31+ }
3232
3333
34- class eoDBSettings (pydantic . BaseSettings ):
34+ class eoDBSettings (BaseSettings ):
3535 """Application settings"""
3636
3737 dbname : str = "eoapi"
@@ -43,29 +43,27 @@ class eoDBSettings(pydantic.BaseSettings):
4343 context : bool = True
4444 mosaic_index : bool = True
4545
46- class Config :
47- """model config"""
48-
49- env_file = ".env"
50- env_prefix = "CDK_EOAPI_DB_"
46+ model_config = {
47+ "env_prefix" : "CDK_EOAPI_DB_" ,
48+ "env_file" : ".env" ,
49+ }
5150
5251
53- class eoSTACSettings (pydantic . BaseSettings ):
52+ class eoSTACSettings (BaseSettings ):
5453 """Application settings"""
5554
5655 env : Dict = {}
5756
5857 timeout : int = 10
5958 memory : int = 256
6059
61- class Config :
62- """model config"""
63-
64- env_file = ".env"
65- env_prefix = "CDK_EOAPI_STAC_"
60+ model_config = {
61+ "env_prefix" : "CDK_EOAPI_STAC_" ,
62+ "env_file" : ".env" ,
63+ }
6664
6765
68- class eoRasterSettings (pydantic . BaseSettings ):
66+ class eoRasterSettings (BaseSettings ):
6967 """Application settings"""
7068
7169 # Default options are optimized for CloudOptimized GeoTIFF
@@ -98,23 +96,21 @@ class eoRasterSettings(pydantic.BaseSettings):
9896 timeout : int = 10
9997 memory : int = 3008
10098
101- class Config :
102- """model config"""
103-
104- env_file = ".env"
105- env_prefix = "CDK_EOAPI_RASTER_"
99+ model_config = {
100+ "env_prefix" : "CDK_EOAPI_RASTER_" ,
101+ "env_file" : ".env" ,
102+ }
106103
107104
108- class eoVectorSettings (pydantic . BaseSettings ):
105+ class eoVectorSettings (BaseSettings ):
109106 """Application settings"""
110107
111108 env : Dict = {}
112109
113110 timeout : int = 10
114111 memory : int = 512
115112
116- class Config :
117- """model config"""
118-
119- env_file = ".env"
120- env_prefix = "CDK_EOAPI_VECTOR_"
113+ model_config = {
114+ "env_prefix" : "CDK_EOAPI_VECTOR_" ,
115+ "env_file" : ".env" ,
116+ }
0 commit comments