mirror of
https://github.com/BillyOutlast/posthog.git
synced 2026-02-04 03:01:23 +01:00
feat(cli): Add flag to skip SSL verification during upload (#35872)
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Co-authored-by: Hugues Pouillot <hugues@posthog.com>
This commit is contained in:
@@ -95,6 +95,11 @@ pub enum SourcemapCommand {
|
||||
/// Whether to delete the source map files after uploading them
|
||||
#[arg(long, default_value = "false")]
|
||||
delete_after: bool,
|
||||
|
||||
/// Whether to skip SSL verification when uploading chunks - only use when using self-signed certificates for
|
||||
/// self-deployed instances
|
||||
#[arg(long, default_value = "false")]
|
||||
skip_ssl_verification: bool,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -131,6 +136,7 @@ impl Cli {
|
||||
project,
|
||||
version,
|
||||
delete_after,
|
||||
skip_ssl_verification,
|
||||
} => {
|
||||
sourcemap::inject::inject(directory)?;
|
||||
sourcemap::upload::upload(
|
||||
@@ -139,6 +145,7 @@ impl Cli {
|
||||
project.clone(),
|
||||
version.clone(),
|
||||
*delete_after,
|
||||
*skip_ssl_verification,
|
||||
)?;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -51,6 +51,7 @@ pub fn upload(
|
||||
project: Option<String>,
|
||||
version: Option<String>,
|
||||
delete_after: bool,
|
||||
skip_ssl_verification: bool,
|
||||
) -> Result<()> {
|
||||
let token = load_token().context("While starting upload command")?;
|
||||
let host = token.get_host(host.as_deref());
|
||||
@@ -83,10 +84,17 @@ pub fn upload(
|
||||
Some(content_hash(uploads.iter().map(|upload| &upload.data))),
|
||||
project,
|
||||
version,
|
||||
skip_ssl_verification,
|
||||
)
|
||||
.context("While creating release")?;
|
||||
|
||||
upload_chunks(&base_url, &token.token, uploads, release.as_ref())?;
|
||||
upload_chunks(
|
||||
&base_url,
|
||||
&token.token,
|
||||
uploads,
|
||||
release.as_ref(),
|
||||
skip_ssl_verification,
|
||||
)?;
|
||||
|
||||
if delete_after {
|
||||
delete_files(sourcemap_paths).context("While deleting sourcemaps")?;
|
||||
@@ -110,8 +118,12 @@ fn upload_chunks(
|
||||
token: &str,
|
||||
uploads: Vec<ChunkUpload>,
|
||||
release: Option<&CreateReleaseResponse>,
|
||||
skip_ssl_verification: bool,
|
||||
) -> Result<()> {
|
||||
let client = reqwest::blocking::Client::new();
|
||||
let client = reqwest::blocking::Client::builder()
|
||||
.danger_accept_invalid_certs(skip_ssl_verification)
|
||||
.build()?;
|
||||
|
||||
let release_id = release.map(|r| r.id.to_string());
|
||||
let chunk_ids = uploads
|
||||
.iter()
|
||||
|
||||
@@ -30,6 +30,7 @@ pub fn create_release(
|
||||
hash_id: Option<String>,
|
||||
project: Option<String>,
|
||||
version: Option<String>,
|
||||
skip_ssl_verification: bool,
|
||||
) -> Result<Option<CreateReleaseResponse>> {
|
||||
let git_info = get_git_info(dir)?;
|
||||
|
||||
@@ -63,7 +64,9 @@ pub fn create_release(
|
||||
host, token.env_id
|
||||
);
|
||||
|
||||
let client = reqwest::blocking::Client::new();
|
||||
let client = reqwest::blocking::Client::builder()
|
||||
.danger_accept_invalid_certs(skip_ssl_verification)
|
||||
.build()?;
|
||||
|
||||
let response = client
|
||||
.post(&url)
|
||||
|
||||
Reference in New Issue
Block a user