Compare commits

...

2 commits

Author SHA1 Message Date
Timo Ley 7a16480269 Merge branch 'master' of https://tilera.xyz/git/tilera/droneconf
All checks were successful
continuous-integration/drone/tag Build is passing
2022-03-23 21:21:04 +01:00
Timo Ley 1ba57ca22c drone config setting may contain config URL 2022-03-23 21:18:35 +01:00
2 changed files with 12 additions and 0 deletions

View file

@ -56,6 +56,13 @@ async fn on_request(
.user_agent("curl")
.timeout(Duration::from_secs(30))
.build()?;
let conf = body.config();
if conf.starts_with("http://") || conf.starts_with("https://") {
let drone_config = client.get(conf).send().await?.text().await?;
let response = Response { data: drone_config };
return Ok(Json(response));
}
let auth = AuthQuery {
access_token: token,
};

View file

@ -10,6 +10,7 @@ pub struct Request {
pub struct Repository {
pub name: String,
pub namespace: String,
pub config_path: String,
}
#[derive(Serialize)]
@ -33,4 +34,8 @@ impl Request {
pub fn name(&self) -> String {
self.repo.name.clone()
}
pub fn config(&self) -> String {
self.repo.config_path.clone()
}
}