File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
packages/settings-library/src/settings_library Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ def print_as_envfile(
2727):
2828 exclude_unset = pydantic_export_options .get ("exclude_unset" , False )
2929
30- for name , field in settings_obj .model_fields .items ():
30+ for name , field in type ( settings_obj ) .model_fields .items ():
3131 auto_default_from_env = (
3232 field .json_schema_extra is not None
3333 and field .json_schema_extra .get ("auto_default_from_env" , False )
@@ -66,6 +66,9 @@ def print_as_envfile(
6666 typer .echo (f"# { field .description } " )
6767 if isinstance (value , Enum ):
6868 value = value .value
69+ elif isinstance (value , dict | list ):
70+ # Serialize complex objects as JSON to ensure they can be parsed correctly
71+ value = json_dumps (value )
6972 typer .echo (f"{ name } ={ value } " )
7073
7174
You canāt perform that action at this time.
0 commit comments