Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
webresetter-frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jonas Leder
webresetter-frontend
Commits
a3f84265
Commit
a3f84265
authored
1 year ago
by
Jonas Leder
Browse files
Options
Downloads
Patches
Plain Diff
add api timeout
parent
28f10cda
No related branches found
Branches containing commit
No related tags found
1 merge request
!4
add api timeout
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.env
+2
-3
2 additions, 3 deletions
.env
config/services.yaml
+2
-0
2 additions, 0 deletions
config/services.yaml
src/Services/WebResetter.php
+16
-8
16 additions, 8 deletions
src/Services/WebResetter.php
with
20 additions
and
11 deletions
.env
+
2
−
3
View file @
a3f84265
...
...
@@ -28,12 +28,11 @@ APP_SECRET=6e3e4d39ef67eb1ef9d8aea9f82d32a0
DATABASE_URL="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=14&charset=utf8"
###< doctrine/doctrine-bundle ###
WEB_RESETTER_IP=10.1.0.1
WEB_RESETTER_APIKEY=
API_TIMEOUT=10
TOTP_ISSUER=WebResetter
###> symfony/lock ###
# Choose one of the stores below
# postgresql+advisory://db_user:db_password@localhost/db_name
LOCK_DSN=flock
###< symfony/lock ###
\ No newline at end of file
###< symfony/lock ###
This diff is collapsed.
Click to expand it.
config/services.yaml
+
2
−
0
View file @
a3f84265
...
...
@@ -10,6 +10,8 @@ services:
_defaults
:
autowire
:
true
# Automatically injects dependencies in your services.
autoconfigure
:
true
# Automatically registers your services as commands, event subscribers, etc.
bind
:
'
int
$apiTimeout'
:
'
%env(API_TIMEOUT)%'
# makes classes in src/ available to be used as services
# this creates a service per class whose id is the fully-qualified class name
...
...
This diff is collapsed.
Click to expand it.
src/Services/WebResetter.php
+
16
−
8
View file @
a3f84265
...
...
@@ -8,7 +8,8 @@ use Symfony\Contracts\HttpClient\HttpClientInterface;
class
WebResetter
{
public
function
__construct
(
private
readonly
HttpClientInterface
$httpClient
private
readonly
HttpClientInterface
$httpClient
,
private
readonly
int
$apiTimeout
)
{
}
...
...
@@ -23,7 +24,8 @@ class WebResetter
'deviceID'
=>
$webResetter
->
getAddress
(),
'shortPress'
=>
$shortPress
,
'apikey'
=>
$webResetter
->
getServer
()
->
getApikey
()
]
],
'timeout'
=>
$this
->
apiTimeout
]
);
if
(
$response
->
getStatusCode
()
!=
200
)
{
...
...
@@ -41,7 +43,8 @@ class WebResetter
'deviceID'
=>
$webResetter
->
getAddress
(),
'shortPress'
=>
$shortPress
,
'apikey'
=>
$webResetter
->
getServer
()
->
getApikey
()
]
],
'timeout'
=>
$this
->
apiTimeout
]
);
if
(
$response
->
getStatusCode
()
!=
200
)
{
...
...
@@ -59,7 +62,8 @@ class WebResetter
'deviceID'
=>
$webResetter
->
getAddress
(),
'power'
=>
$powerOn
,
'apikey'
=>
$webResetter
->
getServer
()
->
getApikey
()
]
],
'timeout'
=>
$this
->
apiTimeout
]
);
if
(
$response
->
getStatusCode
()
!=
200
)
{
...
...
@@ -78,7 +82,8 @@ class WebResetter
'deviceID'
=>
$webResetter
->
getAddress
(),
'delay'
=>
$delay
,
'apikey'
=>
$webResetter
->
getServer
()
->
getApikey
()
]
],
'timeout'
=>
$this
->
apiTimeout
]
);
if
(
$response
->
getStatusCode
()
!=
200
)
{
...
...
@@ -97,7 +102,8 @@ class WebResetter
'deviceID'
=>
$webResetter
->
getAddress
(),
'delay'
=>
$delay
,
'apikey'
=>
$webResetter
->
getServer
()
->
getApikey
()
]
],
'timeout'
=>
$this
->
apiTimeout
]
);
if
(
$response
->
getStatusCode
()
!=
200
)
{
...
...
@@ -116,7 +122,8 @@ class WebResetter
'deviceID'
=>
$webResetter
->
getAddress
(),
'newAddress'
=>
$newAddress
,
'apikey'
=>
$webResetter
->
getServer
()
->
getApikey
()
]
],
'timeout'
=>
$this
->
apiTimeout
]
);
if
(
$response
->
getStatusCode
()
!=
200
)
{
...
...
@@ -134,7 +141,8 @@ class WebResetter
'json'
=>
[
'deviceID'
=>
$webResetter
->
getAddress
(),
'apikey'
=>
$webResetter
->
getServer
()
->
getApikey
()
]
],
'timeout'
=>
$this
->
apiTimeout
]
);
if
(
$response
->
getStatusCode
()
!=
200
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment