mirror of https://github.com/portainer/portainer
feat(templates): support env variables with default value (#161)
parent
71eb3feac9
commit
4827d33ca1
|
@ -55,8 +55,8 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- !name-and-network-inputs -->
|
<!-- !name-and-network-inputs -->
|
||||||
<div ng-repeat="var in selectedTemplate.env" class="form-group">
|
<div ng-repeat="var in selectedTemplate.env" class="form-group">
|
||||||
<label for="field_{{ $index }}" class="col-sm-2 control-label text-left">{{ var.label }}</label>
|
<label ng-if="!var.default" for="field_{{ $index }}" class="col-sm-2 control-label text-left">{{ var.label }}</label>
|
||||||
<div class="col-sm-10">
|
<div ng-if="!var.default" class="col-sm-10">
|
||||||
<input type="text" class="form-control" ng-model="var.value" id="field_{{ $index }}">
|
<input type="text" class="form-control" ng-model="var.value" id="field_{{ $index }}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -72,8 +72,9 @@ function createConfigFromTemplate(template) {
|
||||||
};
|
};
|
||||||
if (template.env) {
|
if (template.env) {
|
||||||
template.env.forEach(function (v) {
|
template.env.forEach(function (v) {
|
||||||
if (v.value) {
|
if (v.value || v.default) {
|
||||||
containerConfig.Env.push(v.name + "=" + v.value);
|
var val = v.default ? v.default : v.value;
|
||||||
|
containerConfig.Env.push(v.name + "=" + val);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue