From e7f3a63f267081a11ec1621516d333f360422682 Mon Sep 17 00:00:00 2001 From: Yvo Brevoort Date: Mon, 10 Oct 2022 11:11:11 +0200 Subject: [PATCH 01/11] add testnet env file --- testnet.env | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 testnet.env diff --git a/testnet.env b/testnet.env new file mode 100644 index 00000000..30609ecb --- /dev/null +++ b/testnet.env @@ -0,0 +1,16 @@ +DB_USER=prejournal_test +DB_DATABASE=prejournal_test +DB_PASSWORD=123456 +DB_HOST=localhost +DB_DRIVER=pdo_pgsql +PREJOURNAL_ADMIN_PARTY=true +PREJOURNAL_USERNAME=admin +PREJOURNAL_PASSWORD=secret +PREJOURNAL_DEFAULT_EMPLOYER=stichting +#WIKI_TOKEN=TOKEN_PASTE_HERE +#WIKI_HOST=https://timesheet.dev3.evoludata.com/api/tabulars +#TIMELD_HOST=https://timeld.org/api +#TIMELD_USERNAME=YOUR_USERNAME +#TIMELD_PASSWORD=YOUR_PASSWORD +#QUICKBOOK_API_URL=https://sandbox-quickbooks.api.intuit.com/v3/company/4620816365245459690 +#QUICKBOOK_API_TOKEN=YOUR_API_TOKEN \ No newline at end of file From af297771134ac4736b6032e48a03bc01241beb51 Mon Sep 17 00:00:00 2001 From: Yvo Brevoort Date: Mon, 10 Oct 2022 11:22:15 +0200 Subject: [PATCH 02/11] database host --- testnet.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testnet.env b/testnet.env index 30609ecb..af9b5ed5 100644 --- a/testnet.env +++ b/testnet.env @@ -1,7 +1,7 @@ DB_USER=prejournal_test DB_DATABASE=prejournal_test DB_PASSWORD=123456 -DB_HOST=localhost +DB_HOST=prejournal-db DB_DRIVER=pdo_pgsql PREJOURNAL_ADMIN_PARTY=true PREJOURNAL_USERNAME=admin From 675aabd3c950e7a0c7c3bac8ce7ff8ea874ee420 Mon Sep 17 00:00:00 2001 From: Yvo Brevoort Date: Mon, 10 Oct 2022 11:56:21 +0200 Subject: [PATCH 03/11] autoinstall schema --- Dockerfile-postgres | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile-postgres b/Dockerfile-postgres index 9e1ebd34..7b2576da 100644 --- a/Dockerfile-postgres +++ b/Dockerfile-postgres @@ -1,2 +1,2 @@ FROM postgres -ADD schema.sql . +COPY schema.sql /docker-entrypoint-initdb.d/ From ae1123a50030c6298b7ee983396fde44831a6ea9 Mon Sep 17 00:00:00 2001 From: Yvo Brevoort Date: Fri, 11 Nov 2022 13:47:30 +0100 Subject: [PATCH 04/11] remove testnet env, will handle it from the testnet docker-compose instead --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 6cd23a5a..c8669e5c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,6 @@ RUN docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql && docker-php-ex COPY --from=composer /usr/bin/composer /usr/bin/composer ADD . /app WORKDIR /app -RUN mv testnet.env .env ENV LOAD_ENV 1 RUN composer install CMD php -S 0.0.0.0:80 src/server.php From 6fea450dd4611f9a2278b88c4879474cf0c4a804 Mon Sep 17 00:00:00 2001 From: Yvo Brevoort Date: Fri, 11 Nov 2022 14:24:25 +0100 Subject: [PATCH 05/11] update tiki and timeld locations for testnet --- testnet.env | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/testnet.env b/testnet.env index af9b5ed5..3bacb3fc 100644 --- a/testnet.env +++ b/testnet.env @@ -7,10 +7,10 @@ PREJOURNAL_ADMIN_PARTY=true PREJOURNAL_USERNAME=admin PREJOURNAL_PASSWORD=secret PREJOURNAL_DEFAULT_EMPLOYER=stichting -#WIKI_TOKEN=TOKEN_PASTE_HERE -#WIKI_HOST=https://timesheet.dev3.evoludata.com/api/tabulars -#TIMELD_HOST=https://timeld.org/api -#TIMELD_USERNAME=YOUR_USERNAME -#TIMELD_PASSWORD=YOUR_PASSWORD +WIKI_TOKEN=TOKEN_PASTE_HERE +WIKI_HOST=http://tikiwiki.local +TIMELD_HOST=http://timeld-gateway.local/api +TIMELD_USERNAME=prejournal +TIMELD_PASSWORD= #QUICKBOOK_API_URL=https://sandbox-quickbooks.api.intuit.com/v3/company/4620816365245459690 #QUICKBOOK_API_TOKEN=YOUR_API_TOKEN \ No newline at end of file From d8acc5b63e68666cbda5b008985398698c110089 Mon Sep 17 00:00:00 2001 From: Yvo Brevoort Date: Fri, 11 Nov 2022 14:25:02 +0100 Subject: [PATCH 06/11] Revert "remove testnet env, will handle it from the testnet docker-compose instead" This reverts commit ae1123a50030c6298b7ee983396fde44831a6ea9. --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index c8669e5c..6cd23a5a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,6 +4,7 @@ RUN docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql && docker-php-ex COPY --from=composer /usr/bin/composer /usr/bin/composer ADD . /app WORKDIR /app +RUN mv testnet.env .env ENV LOAD_ENV 1 RUN composer install CMD php -S 0.0.0.0:80 src/server.php From 2eb61367f37e1e75265debd5ddbb7116ea8fc8d1 Mon Sep 17 00:00:00 2001 From: Yvo Brevoort Date: Fri, 11 Nov 2022 16:06:13 +0100 Subject: [PATCH 07/11] add testnet values --- testnet.env | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/testnet.env b/testnet.env index 3bacb3fc..0bdad097 100644 --- a/testnet.env +++ b/testnet.env @@ -9,8 +9,10 @@ PREJOURNAL_PASSWORD=secret PREJOURNAL_DEFAULT_EMPLOYER=stichting WIKI_TOKEN=TOKEN_PASTE_HERE WIKI_HOST=http://tikiwiki.local -TIMELD_HOST=http://timeld-gateway.local/api +TIMELD_HOST=http://timeld-gateway.local:8080/api TIMELD_USERNAME=prejournal TIMELD_PASSWORD= +TIMELD_TIMESHEET=prejournal/timesheet +TIMELD_PROJECT=prejournal/timesheet-project #QUICKBOOK_API_URL=https://sandbox-quickbooks.api.intuit.com/v3/company/4620816365245459690 #QUICKBOOK_API_TOKEN=YOUR_API_TOKEN \ No newline at end of file From d15620af2a2a7983766025c4a2ad864d16521343 Mon Sep 17 00:00:00 2001 From: Yvo Brevoort Date: Mon, 14 Nov 2022 14:58:10 +0100 Subject: [PATCH 08/11] move tabular id for wiki to config --- src/api/wiki.php | 2 +- testnet.env | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/api/wiki.php b/src/api/wiki.php index 7e51ff25..906e5ed6 100644 --- a/src/api/wiki.php +++ b/src/api/wiki.php @@ -98,7 +98,7 @@ function importWikiFile() function importWiki($data) { - $result = 6; // fetchTabularId(); + $result = $_SERVER["WIKI_TABULAR_ID"]; // fetchTabularId(); $url = $_SERVER["WIKI_HOST"] . '/' .$result . '/import'; $headers = array( "Accept: application/json", diff --git a/testnet.env b/testnet.env index 0bdad097..ff3d25e9 100644 --- a/testnet.env +++ b/testnet.env @@ -8,7 +8,8 @@ PREJOURNAL_USERNAME=admin PREJOURNAL_PASSWORD=secret PREJOURNAL_DEFAULT_EMPLOYER=stichting WIKI_TOKEN=TOKEN_PASTE_HERE -WIKI_HOST=http://tikiwiki.local +WIKI_HOST=http://tikiwiki.local/api/tabulars +WIKI_TABULAR_ID=5 TIMELD_HOST=http://timeld-gateway.local:8080/api TIMELD_USERNAME=prejournal TIMELD_PASSWORD= From 9c0faea636c3d6aaad568f88439bb99bfc1874f1 Mon Sep 17 00:00:00 2001 From: Yvo Brevoort Date: Mon, 14 Nov 2022 17:52:00 +0100 Subject: [PATCH 09/11] make prejournal host configurable --- src/commands/push-to-timeld.php | 5 +++-- src/commands/push-to-wikisuite.php | 9 +++------ testnet.env | 3 ++- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/commands/push-to-timeld.php b/src/commands/push-to-timeld.php index 214c4439..78476b3c 100644 --- a/src/commands/push-to-timeld.php +++ b/src/commands/push-to-timeld.php @@ -34,7 +34,8 @@ function pushMovementsToTimesheet($worker, $arr) } $project = $_SERVER["TIMELD_PROJECT"]; // e.g. "fedb/fedt" $timesheet = $_SERVER["TIMELD_TIMESHEET"]; // e.g. "fedb/from-pounder-source" - + $hostUrl = $_SERVER["PREJOURNAL_HOST"]; + var_dump([ "Push movement to timeld!", $worker, @@ -63,7 +64,7 @@ function pushMovementsToTimesheet($worker, $arr) "@id" => $worker ], "external" => [ - "@id" => "http://time.pondersource.com/movement/" . $arr[$i]["id"] + "@id" => $hostUrl . "/movement/" . $arr[$i]["id"] ] ], JSON_UNESCAPED_SLASHES); } diff --git a/src/commands/push-to-wikisuite.php b/src/commands/push-to-wikisuite.php index f37bb10c..3d8fba1d 100644 --- a/src/commands/push-to-wikisuite.php +++ b/src/commands/push-to-wikisuite.php @@ -33,14 +33,11 @@ function pushMovementsToTabular($worker, $arr) // echo "TIMELD_PROJECT not set!"; return; } - $project = $_SERVER["TIMELD_PROJECT"]; // e.g. "fedb/fedt" - $timesheet = $_SERVER["TIMELD_TIMESHEET"]; // e.g. "fedb/from-pounder-source" + $hostUrl = $_SERVER["PREJOURNAL_HOST"]; var_dump([ "Push movement to wikisuite!", - $worker, - $project, - $timesheet + $worker ]); var_dump($arr); $data = array( @@ -49,7 +46,7 @@ function pushMovementsToTabular($worker, $arr) date_default_timezone_set('UTC'); for ($i = 0; $i < count($arr); $i++) { $data[] = '"' . implode('","', [ - "http://time.pondersource.com/movement/" . $arr[$i]["id"], // URI + $hostUrl . "/movement/" . $arr[$i]["id"], // URI $worker, // User "federated-timesheets", // Project "", // Task diff --git a/testnet.env b/testnet.env index ff3d25e9..a0c0a1dc 100644 --- a/testnet.env +++ b/testnet.env @@ -7,9 +7,10 @@ PREJOURNAL_ADMIN_PARTY=true PREJOURNAL_USERNAME=admin PREJOURNAL_PASSWORD=secret PREJOURNAL_DEFAULT_EMPLOYER=stichting +PREJOURNAL_HOST=http://prejournal.local WIKI_TOKEN=TOKEN_PASTE_HERE WIKI_HOST=http://tikiwiki.local/api/tabulars -WIKI_TABULAR_ID=5 +WIKI_TABULAR_ID=3 TIMELD_HOST=http://timeld-gateway.local:8080/api TIMELD_USERNAME=prejournal TIMELD_PASSWORD= From 0852230025fe9a30718df94f0fe8e4e9a25660f6 Mon Sep 17 00:00:00 2001 From: Yvo Brevoort Date: Tue, 15 Nov 2022 19:34:44 +0100 Subject: [PATCH 10/11] supersecret testnet token --- testnet.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testnet.env b/testnet.env index a0c0a1dc..850adee2 100644 --- a/testnet.env +++ b/testnet.env @@ -8,7 +8,7 @@ PREJOURNAL_USERNAME=admin PREJOURNAL_PASSWORD=secret PREJOURNAL_DEFAULT_EMPLOYER=stichting PREJOURNAL_HOST=http://prejournal.local -WIKI_TOKEN=TOKEN_PASTE_HERE +WIKI_TOKEN=testnet-supersecret-token WIKI_HOST=http://tikiwiki.local/api/tabulars WIKI_TABULAR_ID=3 TIMELD_HOST=http://timeld-gateway.local:8080/api From e83b9715294b408cc6f39e693bb756c1ece0f69e Mon Sep 17 00:00:00 2001 From: Michiel de Jong Date: Mon, 20 Jan 2025 10:17:15 +0100 Subject: [PATCH 11/11] prejournal.org was moved to https://pondersource.github.io/prejournal/ --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 191be887..0c76b4ae 100644 --- a/README.md +++ b/README.md @@ -163,11 +163,11 @@ NB: In general, you would never put a password in a URL or even in a `.env` file we're doing this here to simplify the setup during rapid initial development. See [#9](https://github.com/pondersource/prejournal/issues/9). # Usage (Heroku) -The app's main branch is automatically deployed to https://api.prejournal.org/ on each commit +The app's main branch is automatically deployed to https://api.prejournal..../ on each commit You can try for instance: ``` -curl -d'["alice","alice123"]' https://admin:secret@api.prejournal.org/v1/register # requires admin permissions -curl https://alice:alice123@api.prejournal.org/v1/hello +curl -d'["alice","alice123"]' https://admin:secret@api.prejournal..../v1/register # requires admin permissions +curl https://alice:alice123@api.prejournal..../v1/hello ``` You can also create a Heroku app yourself and deploy a branch of the code there. Feel free, it's open source! @@ -212,7 +212,7 @@ That's why GAAP journals can not really be considered as a database model, they -See [https://prejournal.org/example](https://prejournal.org/example) for some example PHP code. +See [https://prejournal..../example](https://prejournal..../example) for some example PHP code. #### Why?