mirror of
				https://github.com/ets-labs/python-dependency-injector.git
				synced 2025-11-04 09:57:37 +03:00 
			
		
		
		
	Update docs
This commit is contained in:
		
							parent
							
								
									a4cee7d4d5
								
							
						
					
					
						commit
						cb248e0cce
					
				| 
						 | 
					@ -43,8 +43,18 @@ where ``examples/providers/configuration/config.ini`` is:
 | 
				
			||||||
   :language: ini
 | 
					   :language: ini
 | 
				
			||||||
 | 
					
 | 
				
			||||||
:py:meth:`Configuration.from_ini` method supports environment variables interpolation. Use
 | 
					:py:meth:`Configuration.from_ini` method supports environment variables interpolation. Use
 | 
				
			||||||
``${ENV_NAME}`` format in the configuration file to substitute value of the environment
 | 
					``${ENV_NAME}`` format in the configuration file to substitute value from ``ENV_NAME`` environment
 | 
				
			||||||
variable ``ENV_NAME``.
 | 
					variable.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					You can also specify a default value using ``${ENV_NAME:default}`` format. If environment
 | 
				
			||||||
 | 
					variable ``ENV_NAME`` is undefined, configuration provider will substitute value ``default``.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.. code-block:: ini
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   [section]
 | 
				
			||||||
 | 
					   option1 = {$ENV_VAR}
 | 
				
			||||||
 | 
					   option2 = {$ENV_VAR}/path
 | 
				
			||||||
 | 
					   option3 = {$ENV_VAR:default}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Loading from a YAML file
 | 
					Loading from a YAML file
 | 
				
			||||||
------------------------
 | 
					------------------------
 | 
				
			||||||
| 
						 | 
					@ -62,12 +72,22 @@ where ``examples/providers/configuration/config.yml`` is:
 | 
				
			||||||
.. literalinclude:: ../../examples/providers/configuration/config.yml
 | 
					.. literalinclude:: ../../examples/providers/configuration/config.yml
 | 
				
			||||||
   :language: ini
 | 
					   :language: ini
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					:py:meth:`Configuration.from_yaml` method supports environment variables interpolation. Use
 | 
				
			||||||
 | 
					``${ENV_NAME}`` format in the configuration file to substitute value from ``ENV_NAME`` environment
 | 
				
			||||||
 | 
					variable.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					You can also specify a default value using ``${ENV_NAME:default}`` format. If environment
 | 
				
			||||||
 | 
					variable ``ENV_NAME`` is undefined, configuration provider will substitute value ``default``.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.. code-block:: ini
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   section:
 | 
				
			||||||
 | 
					     option1: {$ENV_VAR}
 | 
				
			||||||
 | 
					     option2: {$ENV_VAR}/path
 | 
				
			||||||
 | 
					     option3: {$ENV_VAR:default}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
:py:meth:`Configuration.from_yaml` method uses custom version of ``yaml.SafeLoader``.
 | 
					:py:meth:`Configuration.from_yaml` method uses custom version of ``yaml.SafeLoader``.
 | 
				
			||||||
 | 
					To use another loader use ``loader`` argument:
 | 
				
			||||||
The loader supports environment variables interpolation. Use ``${ENV_NAME}`` format
 | 
					 | 
				
			||||||
in the configuration file to substitute value of the environment variable ``ENV_NAME``.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
You can also specify a YAML loader as an argument:
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
.. code-block:: python
 | 
					.. code-block:: python
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user