Skip to content

Commit e1798a2

Browse files
committed
chore: Add image config file name constant
1 parent 7e6bede commit e1798a2

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

rust/boil/src/build/bakefile.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ use crate::{
2828
utils::{format_image_manifest_uri, format_image_repository_uri},
2929
};
3030

31-
/// This glob pattern matches all (deeply nested) image configs.
32-
pub const ALL_CONFIGS_GLOB_PATTERN: &str = "**/boil-config.toml";
3331
pub const COMMON_TARGET_NAME: &str = "common--target";
3432
pub const ENTRY_TARGET_NAME_PREFIX: &str = "entry--";
3533

@@ -108,7 +106,7 @@ impl IntoIterator for Targets {
108106

109107
impl Targets {
110108
pub fn all(options: TargetsOptions) -> Result<Self, TargetsError> {
111-
let image_config_paths = glob(ALL_CONFIGS_GLOB_PATTERN)
109+
let image_config_paths = glob(ImageConfig::ALL_CONFIGS_GLOB_PATTERN)
112110
.expect("glob pattern must be valid")
113111
.filter_map(Result::ok);
114112

@@ -139,7 +137,9 @@ impl Targets {
139137
// TODO (@Techassi): We should instead build the graph based on the Dockerfile(s),
140138
// because this is the source of truth and what ultimately gets built. The boil config
141139
// files are not a source a truth, but just provide data needed during the build.
142-
let image_config_path = PathBuf::new().join(&image.name).join("boil-config.toml");
140+
let image_config_path = PathBuf::new()
141+
.join(&image.name)
142+
.join(ImageConfig::DEFAULT_FILE_NAME);
143143

144144
// Read the image config which defines supported image versions and their dependencies as
145145
// well as other values.
@@ -179,8 +179,9 @@ impl Targets {
179179
continue;
180180
}
181181

182-
let image_config_path =
183-
PathBuf::new().join(image_name).join("boil-config.toml");
182+
let image_config_path = PathBuf::new()
183+
.join(image_name)
184+
.join(ImageConfig::DEFAULT_FILE_NAME);
184185

185186
let image_config =
186187
ImageConfig::from_file(image_config_path).context(ReadImageConfigSnafu)?;

rust/boil/src/build/image.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ pub struct ImageConfig {
103103
}
104104

105105
impl ImageConfig {
106+
/// This glob pattern matches all (deeply nested) image configs.
107+
pub const ALL_CONFIGS_GLOB_PATTERN: &str = "**/boil-config.toml";
108+
/// The default image config file name.
109+
pub const DEFAULT_FILE_NAME: &str = "boil-config.toml";
110+
106111
pub fn filter_by_version<V>(
107112
self,
108113
versions: &[V],

0 commit comments

Comments
 (0)