Skip to content

Commit e9065e5

Browse files
authored
checks ENV for cfg value before occ call (#47)
1 parent 997ba5d commit e9065e5

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

.github/workflows/py_analysis-coverage.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,17 @@ jobs:
4141
matrix:
4242
nextcloud: [ "25.0.2" ]
4343
php-version: [ "7.4", "8.0" ]
44-
pgsql-version: [ "13", "14", "15" ]
44+
pgsql-version: [ "13", "15" ]
45+
env:
46+
NC_dbname: nextcloud_abz
4547

4648
services:
4749
postgres:
4850
image: postgres:${{ matrix.pgsql-version }}
4951
env:
5052
POSTGRES_USER: root
5153
POSTGRES_PASSWORD: rootpassword
52-
POSTGRES_DB: nextcloud
54+
POSTGRES_DB: ${{ env.NC_dbname }}
5355
options: >-
5456
--health-cmd pg_isready
5557
--health-interval 10s
@@ -84,9 +86,10 @@ jobs:
8486
run: |
8587
tar -xjf nextcloud-${{ matrix.nextcloud }}.tar.bz2 --strip-components 1
8688
mkdir data
87-
php occ maintenance:install --verbose --database=pgsql --database-name=nextcloud \
89+
php occ maintenance:install --verbose --database=pgsql --database-name=${{ env.NC_dbname }} \
8890
--database-host=127.0.0.1 --database-user=root --database-pass=rootpassword \
8991
--admin-user admin --admin-pass adminpassword
92+
sed -i -e 's/${{ env.NC_dbname }}/xyz/g' config/config.php
9093
php occ config:system:set debug --value=true --type=boolean
9194
php -S localhost:8080 &
9295
@@ -226,7 +229,7 @@ jobs:
226229
matrix:
227230
nextcloud: [ "25.0.2" ]
228231
php-version: [ "7.4", "8.0" ]
229-
mariadb-version: [ "10.3", "10.6", "10.10" ]
232+
mariadb-version: [ "10.3", "10.10" ]
230233

231234
services:
232235
mariadb:

nc_py_api/occ.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
def get_cloud_config_value(value_name: str, default=None) -> Union[str, None]:
1212
"""Returns decoded utf8 output of `occ config:system:get {value}` command."""
1313

14+
env_value = os.environ.get("NC_" + value_name, None)
15+
if env_value:
16+
return env_value
1417
_ = occ_call_decode("config:system:get", value_name, log_error=default is None)
1518
return _ if _ is not None else default
1619

0 commit comments

Comments
 (0)