Skip to content

Commit

Permalink
Guard against nil version source
Browse files Browse the repository at this point in the history
  • Loading branch information
thitch97 authored and arjun024 committed Jul 1, 2021
1 parent 0ee40cc commit 272889b
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions build.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,14 @@ func Build(entryResolver EntryResolver, dependencyService DependencyService, pro

logger.SelectedDependency(entry, dependency.Version)

versionSource := entry.Metadata["version-source"].(string)
if versionSource == "buildpack.yml" {
nextMajorVersion := semver.MustParse(context.BuildpackInfo.Version).IncMajor()
logger.Break()
logger.Subprocess("WARNING: Setting the server version through buildpack.yml will be deprecated soon in Nginx Server Buildpack v%s.", nextMajorVersion.String())
logger.Subprocess("Please specify the version through the $BP_NGINX_VERSION environment variable instead. See docs for more information.")
versionSource := entry.Metadata["version-source"]
if versionSource != nil {
if versionSource.(string) == "buildpack.yml" {
nextMajorVersion := semver.MustParse(context.BuildpackInfo.Version).IncMajor()
logger.Break()
logger.Subprocess("WARNING: Setting the server version through buildpack.yml will be deprecated soon in Nginx Server Buildpack v%s.", nextMajorVersion.String())
logger.Subprocess("Please specify the version through the $BP_NGINX_VERSION environment variable instead. See docs for more information.")
}
}
err = os.MkdirAll(filepath.Join(context.WorkingDir, "logs"), os.ModePerm)
if err != nil {
Expand Down

0 comments on commit 272889b

Please sign in to comment.