Permalink
Browse files

Add Handlerbars Block Helper

- `isCompanion <type>` that checks if a type matches any companion type
- `isNotCompanion <type>` that checks if a type does not match any companion type
  • Loading branch information...
schrieveslaach committed Jan 23, 2019
1 parent 99d17fc commit 7b9ae9f29fe3f65eeea855d201562611dfbf3d99
Showing with 238 additions and 27 deletions.
  1. +26 −23 api/Cargo.lock
  2. +7 −0 api/README.md
  3. +1 −1 api/src/commands/list_tickets_command.rs
  4. +4 −1 api/src/models/service.rs
  5. +200 −2 api/src/services/service_templating.rs

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -82,6 +82,13 @@ The list of available handlebars variables:
- `port`: The exposed port of the service
- `type`: The type of service. For example, `instance`, `replica`, `app-companion`, or `service-companion`.

#### Handlebar Helpers

PREvant provides some handlebars helpers which can be used to generate more complex configuration files. See handlerbar's [block helper documentation](https://handlebarsjs.com/block_helpers.html) for more details.

- `{{#isCompanion <type>}}` A conditional handlerbars block helper that checks if the given service type matches any companion type.
- `isNotCompanion <type>` A conditional handlerbars block helper that checks if the given service type does not match any companion type.

### Service Based

The service-based companions works the in the same way as the application-based services. Make sure, that the `serviceName` is unique by using the handlebars templating.
@@ -90,7 +90,7 @@ impl ListTicketsCommand {
let e = ListTicketsError::from(err);
error!("Cannot retrieve ticket information: {}", e);
return Err(e);
},
}
},
}
}
@@ -260,9 +260,13 @@ impl Serialize for Service {

#[derive(Debug, Clone, Eq, Hash, PartialEq, Serialize)]
pub enum ContainerType {
#[serde(rename = "instance")]
Instance,
#[serde(rename = "replica")]
Replica,
#[serde(rename = "app-companion")]
ApplicationCompanion,
#[serde(rename = "service-companion")]
ServiceCompanion,
}

@@ -473,5 +477,4 @@ mod tests {

assert_eq!(&image.to_string(), "docker.io/library/nginx:latest");
}

}
Oops, something went wrong.

0 comments on commit 7b9ae9f

Please sign in to comment.