Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Guardians of the Kretschmar Elock System
Doorcode
Commits
0a14641e
Commit
0a14641e
authored
Dec 17, 2020
by
Jacob Priddy
👌
Browse files
api doc updates
parent
d4e24e69
Pipeline
#13230
passed with stages
in 9 minutes and 21 seconds
Changes
6
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
0a14641e
...
...
@@ -69,12 +69,6 @@ generate_api_docs:
-
cd src/backend
-
sed -i 's/\(^APP_ENV=\).*/\1memory/' .env
-
sed -i "s/\(^APP_URL=\).*/\1https:\/\/${DEPLOY_ADDRESS}/" .env
# TEMPORARY UNTIL THIS BRANCH GETS MERGED INTO THE SCRIBE PROJECT
# PHP 8 came out less than a month ago and not everything supports it yet T_T
-
cd vendor/knuckleswtf
-
rm -rf scribe
-
git clone --branch php8 https://github.com/knuckleswtf/scribe.git
-
cd ../..
-
"
if
(php
artisan
scribe:generate
|
grep
\"
Exception
\"
)
then
echo
\"
Failed
to
generate
API
docs.
\"
&&
false;
else
true;
fi"
artifacts
:
paths
:
...
...
@@ -113,7 +107,7 @@ deploy application:
-
docker build --build-arg APP_IMAGE=$DOORCODE_IMAGE_NAME -t $NGINX_IMAGE_NAME -f nginx.Dockerfile .
-
docker stack deploy -c docker-compose.prod.yml doorcode --prune
# Give it some time to spin up...
-
sleep
6
0
-
sleep
12
0
# Make sure app is running
-
"
curl
--fail
--insecure
--silent
--location
https://${DEPLOY_ADDRESS}/api
>
/dev/null"
-
"
curl
--fail
--insecure
--silent
--location
https://${DEPLOY_ADDRESS}/api/docs
>
/dev/null"
...
...
src/backend/app/Documentation/Strategies/BodyAuthenticationStrategy.php
View file @
0a14641e
...
...
@@ -29,6 +29,9 @@ class BodyAuthenticationStrategy extends Strategy
if
(
$controller
->
getShortName
()
===
'MeController'
)
{
$token
=
'token_string_engr'
;
}
if
(
$controller
->
getShortName
()
===
'DoorController'
)
{
$token
=
'door_1_api_token'
;
}
return
[
'api_token'
=>
[
...
...
src/backend/app/Documentation/Strategies/UnauthenticatedResponseStrategy.php
View file @
0a14641e
...
...
@@ -21,13 +21,19 @@ class UnauthenticatedResponseStrategy extends Strategy
return
null
;
}
return
[
[
$unauthenticated
=
[
'content'
=>
[
'message'
=>
'Unauthenticated'
,
],
'status'
=>
401
,
],
];
if
(
$controller
->
getShortName
()
===
'DoorController'
)
{
return
[
$unauthenticated
];
}
return
[
$unauthenticated
,
[
'content'
=>
[
'message'
=>
'Unauthorized'
,
...
...
src/backend/composer.json
View file @
0a14641e
{
"name"
:
"
laravel/laravel
"
,
"name"
:
"
wwu/elock
"
,
"type"
:
"project"
,
"description"
:
"The Laravel Framework."
,
"keywords"
:
[
"framework"
,
"laravel"
],
"description"
:
"Elock doorcode protection system."
,
"license"
:
"MIT"
,
"require"
:
{
"php"
:
"^8.0"
,
...
...
@@ -14,6 +10,7 @@
"fruitcake/laravel-cors"
:
"^1.0"
,
"laravel/framework"
:
"^8.0"
,
"laravel/tinker"
:
"^2.0"
,
"guzzlehttp/guzzle"
:
"^7.0.1"
,
"laravel/ui"
:
"^3.0"
,
"rlanvin/php-rrule"
:
"^2.2"
,
"ext-json"
:
"*"
...
...
@@ -22,8 +19,8 @@
"bamarni/composer-bin-plugin"
:
"^1.4"
,
"facade/ignition"
:
"^2.3.6"
,
"friendsofphp/php-cs-fixer"
:
"^2.16"
,
"f
zaninotto
/faker"
:
"^1.9.1"
,
"knuckleswtf/scribe"
:
"^2.
0
.0"
,
"f
akerphp
/faker"
:
"^1.9.1"
,
"knuckleswtf/scribe"
:
"^2.
5
.0"
,
"mockery/mockery"
:
"^1.0"
,
"nunomaduro/collision"
:
"^5.0"
,
"phpunit/phpunit"
:
"^9.5"
,
...
...
src/backend/composer.lock
View file @
0a14641e
This diff is collapsed.
Click to expand it.
src/backend/config/scribe.php
View file @
0a14641e
...
...
@@ -98,7 +98,8 @@ return [
* Any extra authentication-related info for your users. For instance, you can describe how to find or generate their auth credentials.
* Markdown and HTML are supported.
*/
'extra_info'
=>
'You can retrieve receive a temporary token by using the login api, or by requesting a permanent API token from an ELock Admin.'
,
'extra_info'
=>
'This API can also be authenticated using a Bearer token (required in the case of doors), or using a session cookie.'
.
'You can retrieve receive a temporary token by using the login api, or by requesting a permanent API token from an Elock Admin.'
,
],
/*
...
...
@@ -131,7 +132,7 @@ INTRO
* The base URL to be used in examples.
* If this is null, Scribe will use the value of config('app.url').
*/
'base_url'
=>
'https://elock.cs.wallawalla.edu'
,
'base_url'
=>
null
,
/*
* Generate a Postman collection in addition to HTML docs.
...
...
@@ -266,8 +267,7 @@ INTRO
'headers'
=>
[
'Content-Type'
=>
'application/json'
,
'Accept'
=>
'application/json'
,
'Authorization'
=>
'Bearer token_string_engr'
,
// 'Api-Version' => 'v2',
// 'Authorization' => 'Bearer token_string_engr',
],
/*
...
...
@@ -454,7 +454,7 @@ INTRO
'headers'
=>
[
'Content-Type'
=>
'application/json'
,
'Accept'
=>
'application/json'
,
'Authorization'
=>
'Bearer token_string_admin'
,
//
'Authorization' => 'Bearer token_string_admin',
],
/*
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment