|
5 | 5 | import json |
6 | 6 |
|
7 | 7 | def write_jupyterlab_config(): |
8 | | - dir_config_jupyterlab = os.getenv('JUPYTER_CONFIG_DIR', |
9 | | - os.path.join(os.getenv('HOME'), '.jupyter') |
10 | | - ) |
11 | | - file_server_config = os.path.join(dir_config_jupyterlab, 'jupyter_server_config.json') |
| 8 | + config_jupyterlab = os.environ['JUPYTER_CONFIG_DIR'] |
| 9 | + file_path = config_jupyterlab + '/jupyter_server_config.json' |
12 | 10 |
|
13 | | - if not os.path.exists(dir_config_jupyterlab): |
14 | | - os.makedirs( dir_config_jupyterlab, exist_ok=True) |
15 | | - elif os.path.isfile(file_server_config) : |
16 | | - with open(file_server_config, "r") as config_file: |
17 | | - config_payload = config_file.read() |
| 11 | + if not os.path.isfile(file_path): |
| 12 | + os.makedirs( config_jupyterlab + '/.jupyter/', exist_ok=True) |
| 13 | + else: |
| 14 | + config_file = open(file_path, 'r') |
| 15 | + config_payload = config_file.read() |
| 16 | + config_file.close() |
18 | 17 |
|
19 | 18 | try: |
20 | 19 | config_json = json.loads(config_payload) |
@@ -89,14 +88,15 @@ def write_jupyterlab_config(): |
89 | 88 | v in atlas_config.items() if v is not None} |
90 | 89 |
|
91 | 90 | config_json['RucioConfig'] = { |
92 | | - 'instances': [escape_config], # atlas, cms, |
| 91 | + 'instances': [escape_config, atlas_config], # cms, |
93 | 92 | "default_instance": os.getenv('RUCIO_DEFAULT_INSTANCE', escape_config['name']), |
94 | 93 | "default_auth_type": os.getenv('RUCIO_DEFAULT_AUTH_TYPE', 'x509_proxy'), |
95 | 94 | } |
96 | 95 |
|
97 | | - config_file = open(file_server_config, 'w') |
| 96 | + config_file = open(file_path, 'w') |
98 | 97 | config_file.write(json.dumps(config_json, indent=2)) |
99 | 98 | config_file.close() |
| 99 | + |
100 | 100 |
|
101 | 101 | # def write_rucio_config(): |
102 | 102 |
|
|
0 commit comments