{{- define "mstore.username" -}}
{{-   if .Values.global -}}
{{-      if .Values.global.mstoreUsername -}}
{{-          .Values.global.mstoreUsername -}}
{{-      else -}}
{{-         fail "Istore username is empty, fill it in global values.yaml !" -}}
{{-      end -}}
{{-   else -}}
{{-      if .Values.main.auth.username -}}
{{-          .Values.main.auth.username -}}
{{-      else -}}
{{-         fail "Istore username is empty, fill it in values.yaml !" -}}
{{-      end }}
{{-   end -}}
{{- end -}}

{{- define "mstore.password" -}}
{{-   if .Values.global -}}
{{-      if .Values.global.mstoreUserpass -}}
{{-          .Values.global.mstoreUserpass -}}
{{-      else -}}
{{-         fail "Istore password is empty, fill it in global values.yaml !"}}
{{-      end -}}
{{-   else -}}
{{-      if .Values.main.auth.password -}}
{{-          .Values.main.auth.password -}}
{{-      else -}}
{{-         fail "Istore password is empty, fill it in values.yaml !"}}
{{-      end -}} 
{{-   end -}}
{{- end -}}
