Skip to content

Commit da57c99

Browse files
authored
Get config information from servicex.yaml and servicex.yml and .servicex files (#138)
With this PR, the frontend will search for config information in a servicex.yaml, servicex.yml, and .servicex files (in that order)
1 parent 91fd8e6 commit da57c99

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Before you can use this library you'll need:
2828

2929
The API access information is normally placed in a `.servicex` file (to keep this confidential information form accidentally getting checked into a public repository). The `servicex` library searches for configuration information in several locations to determine what end-point it should connect to, in the following order:
3030

31-
1. A `.servicex` file in the current working directory
31+
1. A `.servicex` file in the current working directory (it can also be named `servicex.yaml` or `servicex.yml`)
3232
1. A `.servicex` file in the user's home directory (`$HOME` on Linux and Mac, and your profile
3333
directory on Windows).
3434
1. The `config_defaults.yaml` file distributed with the `servicex` package.
@@ -138,6 +138,12 @@ As mentioned above, the `.servicex` file is read to pull a configuration. The se
138138
1. Your current working directory
139139
2. Your home directory
140140

141+
The file can be named any of the following (ordered by precedence):
142+
143+
- `servicex.yaml`
144+
- `servicex.yml`
145+
- `.servicex`
146+
141147
The file can contain an `api_endpoint` as mentioned above. In addition the other following things can be put in:
142148

143149
- `cache_path`: Location where queries, data, and a record of queries are written. This should be an absolute path the person running the library has r/w access to. On windows, make sure to escape `\` - and best to follow standard `yaml` conventions and put the path in quotes - especially if it contains a space. Top level yaml item (don't indent it accidentally!). Defaults to `/tmp/servicex` (with the temp directory as appropriate for your platform) Examples:

servicex/ConfigSettings.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ def _add_local_source(self):
2121
'''
2222
Look for a '.xxx" file in the local directory
2323
'''
24-
p = Path(f'.{self.appname}')
25-
self._add_from_path(p)
24+
self._add_from_path(Path(f'{self.appname}.yaml'))
25+
self._add_from_path(Path(f'{self.appname}.yml'))
26+
self._add_from_path(Path(f'.{self.appname}'))
2627

2728
def _add_from_path(self, p: Path):
2829
if p.exists():
@@ -33,4 +34,6 @@ def _add_home_source(self):
3334
'''
3435
Look for a '.xxx" file in the local directory
3536
'''
37+
self._add_from_path(Path.home() / f'{self.appname}.yaml')
38+
self._add_from_path(Path.home() / f'{self.appname}.yml')
3639
self._add_from_path(Path.home() / f'.{self.appname}')

0 commit comments

Comments
 (0)