Skip to content

Commit

Permalink
fix: Fix queue and topic name suffixing
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark S committed Aug 24, 2022
1 parent d1f136a commit 651de7a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async fn create_topic<T: AsRef<str>>(topic: T) -> Result<SNSTopicARN, Terminator
let topic: String = if CLUSTER_ENV.get().unwrap().is_unknown() {
topic.as_ref().to_string()
} else {
let suffix = CLUSTER_ENV.get().unwrap().for_topic();
let suffix = CLUSTER_ENV.get().unwrap().as_suffix();
println!(
"Suffixing topic \"{}\" as \"{}-{}\" per in-cluster configuration...",
topic.as_ref(),
Expand Down Expand Up @@ -86,7 +86,7 @@ async fn create_queue<T: AsRef<str>>(queue: T) -> Result<(SQSQueueURL, SQSQueueA
let queue: String = if CLUSTER_ENV.get().unwrap().is_unknown() {
queue.as_ref().to_string()
} else {
let suffix = CLUSTER_ENV.get().unwrap().for_queue();
let suffix = CLUSTER_ENV.get().unwrap().as_suffix();
println!(
"Suffixing queue \"{}\" as \"{}-{}\" per in-cluster configuration...",
queue.as_ref(),
Expand Down
12 changes: 1 addition & 11 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,7 @@ impl EnvName {
}
}

pub fn for_queue(&self) -> &str {
match self {
EnvName::QA => "qa",
EnvName::Local => "local",
EnvName::Dev => "development",
EnvName::Prod => "production",
EnvName::Unknown => "unknown",
}
}

pub fn for_topic(&self) -> &str {
pub fn as_suffix(&self) -> &str {
match self {
EnvName::QA => "qa",
EnvName::Dev => "dev",
Expand Down

0 comments on commit 651de7a

Please sign in to comment.