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/ 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? 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/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 new file mode 100644 index 00000000..850adee2 --- /dev/null +++ b/testnet.env @@ -0,0 +1,20 @@ +DB_USER=prejournal_test +DB_DATABASE=prejournal_test +DB_PASSWORD=123456 +DB_HOST=prejournal-db +DB_DRIVER=pdo_pgsql +PREJOURNAL_ADMIN_PARTY=true +PREJOURNAL_USERNAME=admin +PREJOURNAL_PASSWORD=secret +PREJOURNAL_DEFAULT_EMPLOYER=stichting +PREJOURNAL_HOST=http://prejournal.local +WIKI_TOKEN=testnet-supersecret-token +WIKI_HOST=http://tikiwiki.local/api/tabulars +WIKI_TABULAR_ID=3 +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