-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1334 from bonomat/feat/version
feat: also return commit hash and number in version api
- Loading branch information
Showing
5 changed files
with
44 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
// This file is used to generate the environment variables for the Rust analyzer | ||
// to make autometrics docstrings resolve the chosen Prometheus URL. | ||
|
||
use std::process::Command; | ||
fn main() { | ||
// Uncomment the `premetheus_url` line with the desired URL | ||
// Note: Reload Rust analyzer after changing the Prometheus URL to regenerate the links | ||
|
||
// regtest URL | ||
let prometheus_url = "http://testnet.itchysats.network:9090"; | ||
|
||
// local debugging | ||
// let prometheus_url = "http://localhost:9090"; | ||
println!("cargo:rustc-env=PROMETHEUS_URL={prometheus_url}"); | ||
let output = Command::new("git") | ||
.args(["rev-parse", "HEAD"]) | ||
.output() | ||
.expect("To be able to get commit hash"); | ||
let git_hash = String::from_utf8(output.stdout).expect("To be a valid string"); | ||
let output = Command::new("git") | ||
.args(["rev-parse", "--abbrev-ref", "HEAD"]) | ||
.output() | ||
.expect("To be able to get branch name"); | ||
let branch_name = String::from_utf8(output.stdout).expect("To be a valid string"); | ||
println!("cargo:rustc-env=COMMIT_HASH={}", git_hash); | ||
println!("cargo:rustc-env=BRANCH_NAME={}", branch_name); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import 'package:version/version.dart'; | ||
|
||
class CoordinatorVersion { | ||
final Version version; | ||
|
||
CoordinatorVersion(this.version); | ||
|
||
CoordinatorVersion.fromJson(Map<String, dynamic> json) : version = Version.parse(json['version']); | ||
} |