Obj str do it #255
@@ -93,6 +93,11 @@ jobs:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.GARAGE_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.GARAGE_SECRET }}
|
||||
AWS_DEFAULT_REGION: ${{ secrets.GARAGE_REGION }}
|
||||
GARAGE_DEFAULT_ACCESS_KEY: ${{ secrets.GARAGE_KEY_ID }}
|
||||
GARAGE_DEFAULT_SECRET_KEY: ${{ secrets.GARAGE_SECRET }}
|
||||
GARAGE_S3_REGION: ${{ secrets.GARAGE_REGION }}
|
||||
S3_BUCKET_NAME: "soaricarus-bucket"
|
||||
S3_ENDPOINT_URL: "http://localhost:3900"
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/soaricarus_models_deploy_key
|
||||
|
||||
Generated
+1
-1
@@ -1938,7 +1938,7 @@ checksum = "a4933f3f57a8e9d9da04db23fb153356ecaf00cbd14aee46279c33dc80925c37"
|
||||
[[package]]
|
||||
name = "labyrinth"
|
||||
version = "0.0.1"
|
||||
source = "git+ssh://git@git.kundeng.us/phoenix/labyrinth.git?tag=v0.0.1#a29a9fa9f790f30bd6bec1f501ed049d7c9af8b4"
|
||||
source = "git+ssh://git@git.kundeng.us/phoenix/labyrinth.git?tag=v0.0.1-1-742393c25b-928#742393c25b73aa73dce963cb6b4a740e64b93051"
|
||||
dependencies = [
|
||||
"aws-config",
|
||||
"aws-sdk-s3",
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ utoipa-swagger-ui = { version = "9.0.2", features = ["axum"] }
|
||||
simeta = { git = "ssh://git@git.kundeng.us/phoenix/simeta.git", tag = "v0.6.1-main-b690995806-680" }
|
||||
simodels = { git = "ssh://git@git.kundeng.us/phoenix/simodels.git", tag = "v0.11.3-main-fe9d101bd0-111" }
|
||||
sienvy = { git = "ssh://git@git.kundeng.us/phoenix/sienvy.git", tag = "v0.8.0-main-d06c8fdf49-006" }
|
||||
labyrinth = { git = "ssh://git@git.kundeng.us/phoenix/labyrinth.git", tag = "v0.0.1" }
|
||||
labyrinth = { git = "ssh://git@git.kundeng.us/phoenix/labyrinth.git", tag = "v0.0.1-1-742393c25b-928" }
|
||||
|
||||
[dev-dependencies]
|
||||
common-multipart-rfc7578 = { version = "0.7.0" }
|
||||
|
||||
@@ -156,6 +156,7 @@ pub mod endpoint {
|
||||
);
|
||||
|
||||
let raw_data: Vec<u8> = data.to_vec();
|
||||
let copied_raw_data = data.to_vec();
|
||||
match super::is_song_valid(&raw_data).await {
|
||||
Ok(valid) => {
|
||||
if valid {
|
||||
@@ -169,6 +170,58 @@ pub mod endpoint {
|
||||
{
|
||||
Ok(queued_song) => {
|
||||
results.push(queued_song);
|
||||
println!("Uploading to bucket");
|
||||
|
||||
let s3_endpoint_url =
|
||||
sienvy::environment::get_env("S3_ENDPOINT_URL");
|
||||
let bucket_name =
|
||||
sienvy::environment::get_env("S3_BUCKET_NAME");
|
||||
let region =
|
||||
sienvy::environment::get_env("GARAGE_S3_REGION");
|
||||
let access_key_id = sienvy::environment::get_env(
|
||||
"GARAGE_DEFAULT_ACCESS_KEY",
|
||||
);
|
||||
let secret_key = sienvy::environment::get_env(
|
||||
"GARAGE_DEFAULT_SECRET_KEY",
|
||||
);
|
||||
|
||||
let lab_config = labyrinth::config::Config {
|
||||
url: s3_endpoint_url.value,
|
||||
bucket: bucket_name.value,
|
||||
region: region.value,
|
||||
access_key_id: access_key_id.value,
|
||||
secret_key: secret_key.value,
|
||||
};
|
||||
|
||||
println!("Labyrinth config: {lab_config:?}");
|
||||
|
||||
let lr = labyrinth::Labyrinth { config: lab_config };
|
||||
let data = labyrinth::Data {
|
||||
raw_data: copied_raw_data,
|
||||
..Default::default()
|
||||
};
|
||||
let filename = simodels::song::generate_filename(
|
||||
simodels::types::MusicType::FlacExtension,
|
||||
true,
|
||||
)
|
||||
.unwrap();
|
||||
println!("Filename: {filename:?}");
|
||||
let file_path = format!("queued/song/{filename}");
|
||||
println!("Path: {file_path:?}");
|
||||
|
||||
match lr.upload(&file_path, &data).await {
|
||||
Ok(res) => {
|
||||
println!("Result: {res:?}");
|
||||
}
|
||||
Err(err) => match err {
|
||||
labyrinth::Error::Info(err_str) => {
|
||||
eprintln!("Error: {:?}", err_str);
|
||||
}
|
||||
labyrinth::Error::SError(err_s) => {
|
||||
eprintln!("Error: {:?}", err_s);
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
Err(err) => {
|
||||
response.message = err.to_string();
|
||||
|
||||
Reference in New Issue
Block a user