I set them and/or derive them from input parameters.
http://pro.arcgis.com/en/pro-app/tool-reference/environment-settings/current-workspace.htm begins a whole list.
If I want to set something I do it via code, so as to never leave anything to chance or by assumption.
Is there something specific you are wondering about? the arcpy.da.Describe returns lots more information in dictionary form
For example...
pth = "drive:\...some...\...path...\to_a.gdb"
desc = arcpy.da.Describe(pth)
desc.keys()
dict_keys(['catalogPath', 'FIDSet', 'baseName', 'children', 'childrenExpanded',
'connectionProperties', 'connectionString', 'currentRelease', 'dataElementType',
'dataType', 'domains', 'extension', 'file', 'fullPropsRetrieved', 'metadataRetrieved',
'name', 'path', 'release', 'workspaceFactoryProgID', 'workspaceType'])