mirror of
https://github.com/SinTan1729/chhoto-url
synced 2025-02-05 13:52:33 -06:00
Cleaned up code
This commit is contained in:
parent
4fb8d0cb5c
commit
eed3c2292a
1 changed files with 2 additions and 2 deletions
|
@ -29,7 +29,7 @@ pub struct Response {
|
||||||
// If the api_key environment variable eists
|
// If the api_key environment variable eists
|
||||||
pub fn is_api_ok(http: HttpRequest) -> Response {
|
pub fn is_api_ok(http: HttpRequest) -> Response {
|
||||||
// If the api_key environment variable exists
|
// If the api_key environment variable exists
|
||||||
if let Ok(_) = env::var("api_key") {
|
if env::var("api_key").is_ok() {
|
||||||
// If the header exists
|
// If the header exists
|
||||||
if let Some(header) = auth::api_header(&http) {
|
if let Some(header) = auth::api_header(&http) {
|
||||||
// If the header is correct
|
// If the header is correct
|
||||||
|
@ -46,7 +46,7 @@ pub fn is_api_ok(http: HttpRequest) -> Response {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// If the API key isn't set, but an API Key header is provided
|
// If the API key isn't set, but an API Key header is provided
|
||||||
if let Some(_) = auth::api_header(&http) {
|
if auth::api_header(&http).is_some() {
|
||||||
Response {success: false, error: true, reason: "An API key was provided, but the 'api_key' environment variable is not configured in the Chhoto URL instance".to_string(), pass: false}
|
Response {success: false, error: true, reason: "An API key was provided, but the 'api_key' environment variable is not configured in the Chhoto URL instance".to_string(), pass: false}
|
||||||
} else {
|
} else {
|
||||||
Response {success: false, error: false, reason: "".to_string(), pass: true}
|
Response {success: false, error: false, reason: "".to_string(), pass: true}
|
||||||
|
|
Loading…
Reference in a new issue