Skip to content

Commit 9d84bf9

Browse files
authored
Fix Issues notice from APERTUREDB_KEY work (#593)
1 parent 28ef0e1 commit 9d84bf9

File tree

4 files changed

+20
-8
lines changed

4 files changed

+20
-8
lines changed

aperturedb/CommonLibrary.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,12 @@ def create_connector(
164164
This function chooses a configuration in the folowing order:
165165
1. The configuration named by the `name` parameter or `key` parameter
166166
2. The configuration described in the `APERTUREDB_KEY` environment variable.
167-
3. The configuration described in the `APERTUREDB_JSON` environment variable.
168-
4. The configuration described in the `APERTUREDB_JSON` Google Colab secret.
169-
5. The configuration described in the `APERTUREDB_JSON` secret in a `.env` file.
170-
6. The configuration named by the `APERTUREDB_CONFIG` environment variable.
171-
7. The active configuration.
167+
3. The configuration described in the `APERTUREDB_KEY` Google Colab secret.
168+
4. The configuration described in the `APERTUREDB_JSON` environment variable.
169+
5. The configuration described in the `APERTUREDB_JSON` Google Colab secret.
170+
6. The configuration described in the `APERTUREDB_JSON` secret in a `.env` file.
171+
7. The configuration named by the `APERTUREDB_CONFIG` environment variable.
172+
8. The active configuration.
172173
173174
If there are both global and local configurations with the same name, the global configuration is preferred.
174175
@@ -214,6 +215,14 @@ def lookup_config_by_name(name: str, source: str) -> Configuration:
214215
logger.info(
215216
f"Using configuration from APERTUREDB_KEY environment variable")
216217
config = Configuration.reinflate(data)
218+
elif (data := _get_colab_secret("APERTUREDB_KEY")) is not None and data != "":
219+
logger.info(
220+
f"Using configuration from APERTUREDB_KEY Google Colab secret")
221+
config = Configuration.reinflate(data)
222+
if create_config_for_colab_secret:
223+
logger.info(
224+
f"Creating and activating configuration from APERTUREDB_KEY Google Colab secret")
225+
_store_config(config, 'google_colab')
217226
elif (data := os.environ.get("APERTUREDB_JSON")) is not None and data != "":
218227
logger.info(
219228
f"Using configuration from APERTUREDB_JSON environment variable")

aperturedb/cli/configure.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,12 +198,12 @@ def check_for_overwrite(name):
198198
gen_config = _create_configuration_from_json(
199199
json_str, name=name, name_required=True)
200200
check_for_overwrite(gen_config.name)
201-
name = gen_config.name
201+
name = name if name is not None else gen_config.name
202202
elif from_key:
203203
assert interactive, "Interactive mode must be enabled for --from-key"
204204
encoded_str = typer.prompt("Enter encoded string", hide_input=True)
205205
gen_config = Configuration.reinflate(encoded_str)
206-
name = gen_config.name
206+
name = name if name is not None else gen_config.name
207207

208208
else:
209209
if interactive:

test/adb_timing_tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
os.system(command)
1414
diff = datetime.now() - start
1515
print(diff)
16-
assert diff.total_seconds() <= 0.9, f"Command {command} took too long"
16+
assert diff.total_seconds() <= 1.0, f"Command {command} took too long"

test/run_test_container.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ if ! [ -z ${1+x} ]
4646
then
4747
REPOSITORY="$1"
4848
fi
49+
50+
sleep 20 # wait for the containers to be up and running
51+
4952
echo "running tests on docker image $REPOSITORY with $GATEWAY_HTTP and $GATEWAY_NON_HTTP"
5053
docker run \
5154
-v $(pwd)/output:/aperturedata/test/output \

0 commit comments

Comments
 (0)