You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Why make this change?
- Closes#1674 ConfigFile was not found when running in the Azure
Container Apps.
## What is this change?
- Because of the way we used to fetch the cofigFileName, the path was
lost, due to which using config file present in a different directory
was giving `file not found` error.
- So we updated the method to fetch the configFileNamewihoutExtension to
keep the original path.
- To run Azure Container Apps `--ConfigFileName` is provided with the
full path name to the mounted config file.
NOTE:
* This issue might be caught in Az Container apps but this is not
specifically related to Containers, because the current file name
generation process was itself incorrect in 0.8.* release.
* When we try to get the `fileNameWithoutExtension` in the method
`GetFileNameForEnvironment`, we used to lose directory information, for
example: if baseConfigFile is`dab/configs/dab-config.json`, then
`configFileNameWithoutExtension` was coming as `dab-config`, which is
incorrect.
* This issue started happening from 0.8.* because in the earlier release
(0.7.6), if config file name is provided by user, we directly used it
without searching for overrides and environments, unlike 0.8.*. And the
precedence check used to happen for cases where config file is not
provided by user.
* Now, since 0.8.*, we started using the method
`GetFileNameWithoutExtension`, which is incorrect causing File not found
issue whenever the config file is not in current directory.
* The method `DoesFileExistInCurrentDirectory()` checks if the file
exists by combining the current directory with the fileName. Now if file
is existing in some other directory inside current directory, then for
proper searching the file should contain complete info about the
directory. So, if current dicrectory is `C:/dab`, and file is in
`C:/dab/configs/dab-config.json`, then the file name should either be
full path or `/configs/dab-configs.json` for it to be searched.
## Additional Change
1. Fixing name of variables and function name to correctly reflect their
behavior.
2. Fixing issue with not honoring the user provided config file, (caused
after 0.8 release). (Putting in this PR, because this PR aims at fixing
how we are using the config files and not just a bug fix.)
## How was this tested?
- [X] Running In Azure Container Apps
BEFORE:

AFTER:

- [X] Local Testing
BEFORE:

AFTER:

- [X] Unit Tests
---------
Co-authored-by: Aniruddh Munde <[email protected]>
// If the baseConfigFilePath contains directory info, we need to ensure that it is not lost. for example: baseConfigFilePath = "config/dab-config.json"
183
+
// in this case, we need to get the directory name and the file name without extension and then combine them back. Else, we will lose the path
184
+
// and the file will be searched in the current directory.
[DataRow("my-config.json","",false,null,"my-config.json",DisplayName="Config file in the current directory provided by user and environment variable is not set")]
2035
+
[DataRow("test-configs/my-config.json","",false,null,"test-configs/my-config.json",DisplayName="Config file in different directory provided by user and environment variable is not set")]
2036
+
[DataRow("my-config.json","Test",false,"my-config.Test.json","my-config.json",DisplayName="Config file in the current directory provided by user and environment variable is set")]
2037
+
[DataRow("test-configs/my-config.json","Test",false,"test-configs/my-config.Test.json","test-configs/my-config.json",DisplayName="Config file in different directory provided by user and environment variable is set")]
2038
+
[DataRow("my-config.json","Test",false,"dab-config.Test.json","my-config.json",DisplayName="Config file in the current directory provided by user and environment variable is set and environment file is present")]
2039
+
[DataRow("test-configs/my-config.json","Test",false,"test-configs/dab-config.Test.json","test-configs/my-config.json",DisplayName="Config file in different directory provided by user and environment variable is set and environment file is present")]
2040
+
[DataRow("my-config.json","",true,null,"my-config.json",DisplayName="Config file in the current directory provided by user and environment variable is not set and absolute path is provided")]
2041
+
[DataRow("test-configs/my-config.json","",true,null,"test-configs/my-config.json",DisplayName="Config file in different directory provided by user and environment variable is not set and absolute path is provided")]
2042
+
[DataRow("my-config.json","Test",true,"my-config.Test.json","my-config.json",DisplayName="Config file in the current directory provided by user and environment variable is set and absolute path is provided")]
2043
+
[DataRow("test-configs/my-config.json","Test",true,"test-configs/my-config.Test.json","test-configs/my-config.json",DisplayName="Config file in different directory provided by user and environment variable is set and absolute path is provided")]
2044
+
[DataRow("my-config.json","Test",true,"dab-config.Test.json","my-config.json",DisplayName="Config file in the current directory provided by user and environment variable is set and environment file is present and absolute path is provided")]
2045
+
[DataRow("test-configs/my-config.json","Test",true,"test-configs/dab-config.Test.json","test-configs/my-config.json",DisplayName="Config file in the different directory provided by user and environment variable is set and environment file is present and absolute path is provided")]
2046
+
[DataRow(null,"",false,null,"dab-config.json",DisplayName="Config file not provided by user and environment variable is not set")]
2047
+
[DataRow(null,"Test",false,"dab-config.Test.json","dab-config.json",DisplayName="Config file not provided by user and environment variable is set and environment file is present")]
2048
+
[DataRow(null,"Test",false,null,"dab-config.json",DisplayName="Config file not provided by user and environment variable is set and environment file is not present")]
0 commit comments