Alternative $menu variable usage in menus

My goal is to use additional menu names in modules, beside main, sidebar will always be global. Menu example, in /docs/hugo.yaml:

menus:
  main:
    - identifier: documentation
      name: Documentation
      pageRef: /docs
      weight: 1

Menu example, in module /project/hugo.yaml, included in /docs:

menus:
  project:
    - identifier: wiki
      name: Documentation
      pageRef: /wiki
      weight: 1
sectionPagesMenu: project

Considering the following navbar template:

{{- $menu := .Site.Params.sectionPagesMenu | default "main" -}}

{{- range (index .Site.Menus $menu) -}}
  {{- $active := or ($currentPage.HasMenuCurrent $menu .) ($currentPage.IsMenuCurrent $menu .) -}}
    HTML CODE
  {{- end -}}
{{- end -}}

Is this considered the correct approach? I’m not sure if there is a better way to do this, thank you for your guidance.

For reference, original theme template is:

{{- range .Site.Menus.main -}}
  {{- $active := or ($currentPage.HasMenuCurrent "main" .) ($currentPage.IsMenuCurrent "main" .) -}}
    HTML CODE
  {{- end -}}
{{- end -}}