Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Shinto C V
Pod backend
Commits
eae3d301
Verified
Commit
eae3d301
authored
4 years ago
by
Vasili Novikov
Browse files
Options
Download
Email Patches
Plain Diff
Clean up, include git hash in http version
parent
488a6ccb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+7
-5
.gitlab-ci.yml
src/internal_api.rs
+4
-14
src/internal_api.rs
with
11 additions
and
19 deletions
+11
-19
.gitlab-ci.yml
+
7
-
5
View file @
eae3d301
...
...
@@ -10,12 +10,14 @@ variables:
CARGO_HOME
:
$CI_PROJECT_DIR/cargo
APT_CACHE_DIR
:
$CI_PROJECT_DIR/apt
# WARNING:
# Project currently uses a dirty work-around:
# it installs dependencies/components on GitLab shell runner,
# as opposed to doing it in a reproducible fashion
#
# - apt-get update -yq
# - apt-get install -o dir::cache::archives="$APT_CACHE_DIR" -y libsqlcipher-dev buildah
before_script
:
# WARNING: dirty work-around:
# `libsqlcipher-dev` is right now installed on gitlab-runner (shell) host
-
dpkg -l libsqlcipher-dev
# - apt-get update -yq
# - apt-get install -o dir::cache::archives="$APT_CACHE_DIR" -y libsqlcipher-dev
-
rustup component add rustfmt
-
rustup component add clippy
...
...
This diff is collapsed.
Click to expand it.
src/internal_api.rs
+
4
-
14
View file @
eae3d301
...
...
@@ -14,7 +14,6 @@ use chrono::Utc;
use
log
::
debug
;
use
log
::
info
;
use
r2d2
::
Pool
;
use
r2d2
::
PooledConnection
;
use
r2d2_sqlite
::
SqliteConnectionManager
;
use
rusqlite
::
ToSql
;
use
rusqlite
::
Transaction
;
...
...
@@ -26,20 +25,11 @@ use std::process::Command;
use
std
::
str
;
use
warp
::
http
::
status
::
StatusCode
;
/// Check if item exists by uid
pub
fn
_check_item_exist
(
conn
:
&
PooledConnection
<
SqliteConnectionManager
>
,
uid
:
i64
,
)
->
Result
<
bool
>
{
let
sql
=
format!
(
"SELECT COUNT(*) FROM items WHERE uid = {};"
,
uid
);
let
result
:
i64
=
conn
.query_row
(
&
sql
,
NO_PARAMS
,
|
row
|
row
.get
(
0
))
?
;
Ok
(
result
!=
0
)
}
/// Get project version as seen by Cargo.
pub
fn
get_project_version
()
->
&
'static
str
{
debug!
(
"Returning API version..."
);
env!
(
"CARGO_PKG_VERSION"
)
pub
fn
get_project_version
()
->
String
{
let
git
=
env!
(
"GIT_DESCRIBE"
);
let
cargo
=
env!
(
"CARGO_PKG_VERSION"
);
format!
(
"{}-cargo{})"
,
git
,
cargo
)
}
/// See HTTP_API.md for details
...
...
This diff is collapsed.
Click to expand it.
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