
<!doctype html>
<html lang="en" class="no-js">
  <head>
     
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width,initial-scale=1">
      
      
      
        <link rel="canonical" href="http://hexmos.com/lama2/reference/preprocess.html">
      
      <link rel="icon" href="../favicon.ico">
      <meta name="generator" content="mkdocs-1.4.2, mkdocs-material-8.5.10">
    

<meta
  name="description"
  content="Hexmos Lama2: Plain-Text Powered REST API Client for Teams"
/>
<meta
  name="keywords"
  content="api, language, http, dsl, api-client, api-rest, api-design, postman-collection, insomnia"
/>

<!-- Facebook Meta Tags -->
<meta property="og:url" content="https://hexmos.com/lama2" />
<meta property="og:type" content="website" />
<meta
  property="og:title"
  content="Hexmos Lama2: Plain-Text Powered REST API Client for Teams"
/>
<meta
  property="og:description"
  content="Hexmos Lama2: Human-friendly syntax and CLI for describing and executing APIs, store and collaborate on API files using version control. Ships with IDE and text-editor integrations. Markdown for APIs."
/>
<meta property="og:image" content="https://hexmos.com/lama2/banner.png" />

<!-- Twitter Meta Tags -->
<meta name="twitter:card" content="summary_large_image" />
<meta property="twitter:domain" content="hexmos.com" />
<meta property="twitter:url" content="https://hexmos.com/lama2" />
<meta
  name="twitter:title"
  content="Hexmos Lama2: Plain-Text Powered REST API Client for Teams"
/>
<meta
  name="twitter:description"
  content="Hexmos Lama2: Human-friendly syntax and CLI for describing and executing APIs, store and collaborate on API files using version control. Ships with IDE and text-editor integrations. Markdown for APIs."
/>
<meta name="twitter:image" content="https://hexmos.com/lama2/banner.png" />
<script src="../analytics.js"></script>


    
      
        <title>Preprocess - Hexmos Lama2</title>
      
    
    
      <link rel="stylesheet" href="../assets/stylesheets/main.975780f9.min.css">
      
        
        <link rel="stylesheet" href="../assets/stylesheets/palette.2505c338.min.css">
        
      
      

    
    
    
      
        
        
        <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
        <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i%7CRoboto+Mono:400,400i,700,700i&display=fallback">
        <style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style>
      
    
    
    <script>__md_scope=new URL("..",location),__md_hash=e=>[...e].reduce((e,_)=>(e<<5)-e+_.charCodeAt(0),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
    
      
  


  
  


  <script id="__analytics">function __md_analytics(){function n(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],n("js",new Date),n("config","G-WXSDF484XZ"),document.addEventListener("DOMContentLoaded",function(){document.forms.search&&document.forms.search.query.addEventListener("blur",function(){this.value&&n("event","search",{search_term:this.value})}),document$.subscribe(function(){var a=document.forms.feedback;if(void 0!==a)for(var e of a.querySelectorAll("[type=submit]"))e.addEventListener("click",function(e){e.preventDefault();var t=document.location.pathname,e=this.getAttribute("data-md-value");n("event","feedback",{page:t,data:e}),a.firstElementChild.disabled=!0;e=a.querySelector(".md-feedback__note [data-md-value='"+e+"']");e&&(e.hidden=!1)}),a.hidden=!1}),location$.subscribe(function(e){n("config","G-WXSDF484XZ",{page_path:e.pathname})})});var e=document.createElement("script");e.async=!0,e.src="https://www.googletagmanager.com/gtag/js?id=G-WXSDF484XZ",document.getElementById("__analytics").insertAdjacentElement("afterEnd",e)}</script>

  
    <script>"undefined"!=typeof __md_analytics&&__md_analytics()</script>
  

    
    
    
  </head>
  
  
    
    
      
    
    
    
    
    <body dir="ltr" data-md-color-scheme="default" data-md-color-primary="" data-md-color-accent="">
  
    
    
      <script>var palette=__md_get("__palette");if(palette&&"object"==typeof palette.color)for(var key of Object.keys(palette.color))document.body.setAttribute("data-md-color-"+key,palette.color[key])</script>
    
    <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
    <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
    <label class="md-overlay" for="__drawer"></label>
    <div data-md-component="skip">
      
        
        <a href="#preprocess" class="md-skip">
          Skip to content
        </a>
      
    </div>
    <div data-md-component="announce">
      
    </div>
    
    
      

<header class="md-header" data-md-component="header">
  <nav class="md-header__inner md-grid" aria-label="Header">
    <a href="../index.html" title="Hexmos Lama2" class="md-header__button md-logo" aria-label="Hexmos Lama2" data-md-component="logo">
      
  <img src="../logo.png" alt="logo">

    </a>
    <label class="md-header__button md-icon" for="__drawer">
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2Z"/></svg>
    </label>
    <div class="md-header__title" data-md-component="header-title">
      <div class="md-header__ellipsis">
        <div class="md-header__topic">
          <span class="md-ellipsis">
            Hexmos Lama2
          </span>
        </div>
        <div class="md-header__topic" data-md-component="header-topic">
          <span class="md-ellipsis">
            
              Preprocess
            
          </span>
        </div>
      </div>
    </div>
    
      <form class="md-header__option" data-md-component="palette">
        
          
          
          
          <input class="md-option" data-md-color-media="" data-md-color-scheme="default" data-md-color-primary="" data-md-color-accent=""  aria-label="Switch to dark mode"  type="radio" name="__palette" id="__palette_1">
          
            <label class="md-header__button md-icon" title="Switch to dark mode" for="__palette_2" hidden>
              <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a4 4 0 0 0-4 4 4 4 0 0 0 4 4 4 4 0 0 0 4-4 4 4 0 0 0-4-4m0 10a6 6 0 0 1-6-6 6 6 0 0 1 6-6 6 6 0 0 1 6 6 6 6 0 0 1-6 6m8-9.31V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12 20 8.69Z"/></svg>
            </label>
          
        
          
          
          
          <input class="md-option" data-md-color-media="" data-md-color-scheme="slate" data-md-color-primary="" data-md-color-accent=""  aria-label="Switch to light mode"  type="radio" name="__palette" id="__palette_2">
          
            <label class="md-header__button md-icon" title="Switch to light mode" for="__palette_1" hidden>
              <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 18c-.89 0-1.74-.2-2.5-.55C11.56 16.5 13 14.42 13 12c0-2.42-1.44-4.5-3.5-5.45C10.26 6.2 11.11 6 12 6a6 6 0 0 1 6 6 6 6 0 0 1-6 6m8-9.31V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12 20 8.69Z"/></svg>
            </label>
          
        
      </form>
    
    
    
      <label class="md-header__button md-icon" for="__search">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z"/></svg>
      </label>
      <div class="md-search" data-md-component="search" role="dialog">
  <label class="md-search__overlay" for="__search"></label>
  <div class="md-search__inner" role="search">
    <form class="md-search__form" name="search">
      <input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" required>
      <label class="md-search__icon md-icon" for="__search">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z"/></svg>
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12Z"/></svg>
      </label>
      <nav class="md-search__options" aria-label="Search">
        
        <button type="reset" class="md-search__icon md-icon" title="Clear" aria-label="Clear" tabindex="-1">
          <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41Z"/></svg>
        </button>
      </nav>
      
    </form>
    <div class="md-search__output">
      <div class="md-search__scrollwrap" data-md-scrollfix>
        <div class="md-search-result" data-md-component="search-result">
          <div class="md-search-result__meta">
            Initializing search
          </div>
          <ol class="md-search-result__list"></ol>
        </div>
      </div>
    </div>
  </div>
</div>
    
    
      <div class="md-header__source">
        <a href="https://github.com/HexmosTech/Lama2" title="Go to repository" class="md-source" data-md-component="source">
  <div class="md-source__icon md-icon">
    
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 6.2.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc.--><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81z"/></svg>
  </div>
  <div class="md-source__repository">
    GitHub
  </div>
</a>
      </div>
    
  </nav>
  
</header>
    
    <div class="md-container" data-md-component="container">
      
      
        
          
        
      
      <main class="md-main" data-md-component="main">
        <div class="md-main__inner md-grid">
          
            
              
              <div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
                <div class="md-sidebar__scrollwrap">
                  <div class="md-sidebar__inner">
                    


<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
  <label class="md-nav__title" for="__drawer">
    <a href="../index.html" title="Hexmos Lama2" class="md-nav__button md-logo" aria-label="Hexmos Lama2" data-md-component="logo">
      
  <img src="../logo.png" alt="logo">

    </a>
    Hexmos Lama2
  </label>
  
    <div class="md-nav__source">
      <a href="https://github.com/HexmosTech/Lama2" title="Go to repository" class="md-source" data-md-component="source">
  <div class="md-source__icon md-icon">
    
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 6.2.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc.--><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81z"/></svg>
  </div>
  <div class="md-source__repository">
    GitHub
  </div>
</a>
    </div>
  
  <ul class="md-nav__list" data-md-scrollfix>
    
      
      
      

  
  
  
    <li class="md-nav__item">
      <a href="../index.html" class="md-nav__link">
        Home
      </a>
    </li>
  

    
      
      
      

  
  
  
    
      
    
    <li class="md-nav__item md-nav__item--section md-nav__item--nested">
      
      
        <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_2" type="checkbox" id="__nav_2" >
      
      
      
      
        <label class="md-nav__link" for="__nav_2">
          Get Started
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <nav class="md-nav" aria-label="Get Started" data-md-level="1">
        <label class="md-nav__title" for="__nav_2">
          <span class="md-nav__icon md-icon"></span>
          Get Started
        </label>
        <ul class="md-nav__list" data-md-scrollfix>
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../tutorials/installation.html" class="md-nav__link">
        Installation
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../tutorials/postman.html" class="md-nav__link">
        Import Postman
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../tutorials/examples.html" class="md-nav__link">
        Examples
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../tutorials/collaboration.html" class="md-nav__link">
        Collaboration
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../tutorials/codegen.html" class="md-nav__link">
        Code Generation
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../tutorials/misc.html" class="md-nav__link">
        Misc
      </a>
    </li>
  

            
          
        </ul>
      </nav>
    </li>
  

    
      
      
      

  
  
  
    
      
    
    <li class="md-nav__item md-nav__item--section md-nav__item--nested">
      
      
        <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_3" type="checkbox" id="__nav_3" >
      
      
      
      
        <label class="md-nav__link" for="__nav_3">
          Understand
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <nav class="md-nav" aria-label="Understand" data-md-level="1">
        <label class="md-nav__title" for="__nav_3">
          <span class="md-nav__icon md-icon"></span>
          Understand
        </label>
        <ul class="md-nav__list" data-md-scrollfix>
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../explanation/syntax.html" class="md-nav__link">
        Syntax Guidance
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../explanation/l2format.html" class="md-nav__link">
        The l2 Format
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../explanation/faq.html" class="md-nav__link">
        FAQ/RAQ
      </a>
    </li>
  

            
          
        </ul>
      </nav>
    </li>
  

    
      
      
      

  
  
  
    
      
    
    <li class="md-nav__item md-nav__item--section md-nav__item--nested">
      
      
        <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_4" type="checkbox" id="__nav_4" >
      
      
      
      
        <label class="md-nav__link" for="__nav_4">
          Develop
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <nav class="md-nav" aria-label="Develop" data-md-level="1">
        <label class="md-nav__title" for="__nav_4">
          <span class="md-nav__icon md-icon"></span>
          Develop
        </label>
        <ul class="md-nav__list" data-md-scrollfix>
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="philosophy.html" class="md-nav__link">
        Design Philosophy
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="architecture.html" class="md-nav__link">
        Architecture
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../tutorials/editor.html" class="md-nav__link">
        IDE/Editor Support
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="grammar.html" class="md-nav__link">
        Formal Grammar
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="api.html" class="md-nav__link">
        API Reference
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="lsp.html" class="md-nav__link">
        Contribute to LSP
      </a>
    </li>
  

            
          
        </ul>
      </nav>
    </li>
  

    
      
      
      

  
  
  
    
      
    
    <li class="md-nav__item md-nav__item--section md-nav__item--nested">
      
      
        <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_5" type="checkbox" id="__nav_5" >
      
      
      
      
        <label class="md-nav__link" for="__nav_5">
          LiveAPI
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <nav class="md-nav" aria-label="LiveAPI" data-md-level="1">
        <label class="md-nav__title" for="__nav_5">
          <span class="md-nav__icon md-icon"></span>
          LiveAPI
        </label>
        <ul class="md-nav__list" data-md-scrollfix>
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../liveapi/aboutliveapi.html" class="md-nav__link">
        About
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../liveapi/setupliveapi.html" class="md-nav__link">
        Easy Installation
      </a>
    </li>
  

            
          
        </ul>
      </nav>
    </li>
  

    
      
      
      

  
  
  
    
      
    
    <li class="md-nav__item md-nav__item--section md-nav__item--nested">
      
      
        <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_6" type="checkbox" id="__nav_6" >
      
      
      
      
        <label class="md-nav__link" for="__nav_6">
          About
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <nav class="md-nav" aria-label="About" data-md-level="1">
        <label class="md-nav__title" for="__nav_6">
          <span class="md-nav__icon md-icon"></span>
          About
        </label>
        <ul class="md-nav__list" data-md-scrollfix>
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../about/hexmos.html" class="md-nav__link">
        Hexmos
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../about/contact.html" class="md-nav__link">
        Talk to us
      </a>
    </li>
  

            
          
        </ul>
      </nav>
    </li>
  

    
  </ul>
</nav>
                  </div>
                </div>
              </div>
            
            
              
              <div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
                <div class="md-sidebar__scrollwrap">
                  <div class="md-sidebar__inner">
                    

<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
  
  
  
    
  
  
    <label class="md-nav__title" for="__toc">
      <span class="md-nav__icon md-icon"></span>
      Table of contents
    </label>
    <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
      
        <li class="md-nav__item">
  <a href="#index" class="md-nav__link">
    Index
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#func-expandenv" class="md-nav__link">
    func ExpandEnv
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#func-expandheaders" class="md-nav__link">
    func ExpandHeaders
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#func-expandjson" class="md-nav__link">
    func ExpandJSON
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#func-expandurl" class="md-nav__link">
    func ExpandURL
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#func-getl2envvariables" class="md-nav__link">
    func GetL2EnvVariables
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#func-getlamafileasstring" class="md-nav__link">
    func GetLamaFileAsString
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#func-lamafile" class="md-nav__link">
    func LamaFile
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#func-loadenvfile" class="md-nav__link">
    func LoadEnvFile
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#func-loadenvironments" class="md-nav__link">
    func LoadEnvironments
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#func-processvarsinblock" class="md-nav__link">
    func ProcessVarsInBlock
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#func-searchl2configenv" class="md-nav__link">
    func SearchL2ConfigEnv
  </a>
  
</li>
      
    </ul>
  
</nav>
                  </div>
                </div>
              </div>
            
          
          
            <div class="md-content" data-md-component="content">
              <article class="md-content__inner md-typeset">
                
                  

  <a href="https://github.com/HexmosTech/Lama2/edit/master/docs/reference/preprocess.md" title="Edit this page" class="md-content__button md-icon">
    
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83 3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75L3 17.25Z"/></svg>
  </a>


<!-- Code generated by gomarkdoc. DO NOT EDIT -->

<h1 id="preprocess">preprocess<a class="headerlink" href="#preprocess" title="Permanent link">&para;</a></h1>
<div class="highlight"><pre><span></span><code><span class="kn">import</span><span class="w"> </span><span class="s">&quot;github.com/HexmosTech/lama2/preprocess&quot;</span>
</code></pre></div>
<p>Package preprocess provides facilities to expand environment variables in `.l2` API files and return the contents</p>
<h2 id="index">Index<a class="headerlink" href="#index" title="Permanent link">&para;</a></h2>
<ul>
<li><a href="#ExpandEnv">func ExpandEnv(s string, vm interface{}) string</a></li>
<li><a href="#ExpandHeaders">func ExpandHeaders(block *gabs.Container, vm interface{})</a></li>
<li><a href="#ExpandJSON">func ExpandJSON(block *gabs.Container, vm interface{})</a></li>
<li><a href="#ExpandURL">func ExpandURL(block *gabs.Container, vm interface{})</a></li>
<li><a href="#GetL2EnvVariables">func GetL2EnvVariables(dir string) (map[string]map[string]interface{}, error)</a></li>
<li><a href="#GetLamaFileAsString">func GetLamaFileAsString(path string) (string, error)</a></li>
<li><a href="#LamaFile">func LamaFile(inputFile string) (string, string)</a></li>
<li><a href="#LoadEnvFile">func LoadEnvFile(l2path string)</a></li>
<li><a href="#LoadEnvironments">func LoadEnvironments(dir string)</a></li>
<li><a href="#ProcessVarsInBlock">func ProcessVarsInBlock(block *gabs.Container, vm interface{})</a></li>
<li><a href="#SearchL2ConfigEnv">func SearchL2ConfigEnv(dir string) (string, error)</a></li>
</ul>
<p><a name="ExpandEnv"></a></p>
<h2 id="func-expandenv">func <a href="https://github.com/HexmosTech/Lama2/blob/main/preprocess/expandvar.go#L59">ExpandEnv</a><a class="headerlink" href="#func-expandenv" title="Permanent link">&para;</a></h2>
<div class="highlight"><pre><span></span><code><span class="kd">func</span><span class="w"> </span><span class="nx">ExpandEnv</span><span class="p">(</span><span class="nx">s</span><span class="w"> </span><span class="kt">string</span><span class="p">,</span><span class="w"> </span><span class="nx">vm</span><span class="w"> </span><span class="kd">interface</span><span class="p">{})</span><span class="w"> </span><span class="kt">string</span>
</code></pre></div>
<p>ExpandEnv replaces ${var} or $var in the string according to the values of the current environment variables. References to undefined variables are replaced by the empty string.</p>
<p><a name="ExpandHeaders"></a></p>
<h2 id="func-expandheaders">func <a href="https://github.com/HexmosTech/Lama2/blob/main/preprocess/preprocess.go#L174">ExpandHeaders</a><a class="headerlink" href="#func-expandheaders" title="Permanent link">&para;</a></h2>
<div class="highlight"><pre><span></span><code><span class="kd">func</span><span class="w"> </span><span class="nx">ExpandHeaders</span><span class="p">(</span><span class="nx">block</span><span class="w"> </span><span class="o">*</span><span class="nx">gabs</span><span class="p">.</span><span class="nx">Container</span><span class="p">,</span><span class="w"> </span><span class="nx">vm</span><span class="w"> </span><span class="kd">interface</span><span class="p">{})</span>
</code></pre></div>
<p><a name="ExpandJSON"></a></p>
<h2 id="func-expandjson">func <a href="https://github.com/HexmosTech/Lama2/blob/main/preprocess/preprocess.go#L202">ExpandJSON</a><a class="headerlink" href="#func-expandjson" title="Permanent link">&para;</a></h2>
<div class="highlight"><pre><span></span><code><span class="kd">func</span><span class="w"> </span><span class="nx">ExpandJSON</span><span class="p">(</span><span class="nx">block</span><span class="w"> </span><span class="o">*</span><span class="nx">gabs</span><span class="p">.</span><span class="nx">Container</span><span class="p">,</span><span class="w"> </span><span class="nx">vm</span><span class="w"> </span><span class="kd">interface</span><span class="p">{})</span>
</code></pre></div>
<p><a name="ExpandURL"></a></p>
<h2 id="func-expandurl">func <a href="https://github.com/HexmosTech/Lama2/blob/main/preprocess/preprocess.go#L194">ExpandURL</a><a class="headerlink" href="#func-expandurl" title="Permanent link">&para;</a></h2>
<div class="highlight"><pre><span></span><code><span class="kd">func</span><span class="w"> </span><span class="nx">ExpandURL</span><span class="p">(</span><span class="nx">block</span><span class="w"> </span><span class="o">*</span><span class="nx">gabs</span><span class="p">.</span><span class="nx">Container</span><span class="p">,</span><span class="w"> </span><span class="nx">vm</span><span class="w"> </span><span class="kd">interface</span><span class="p">{})</span>
</code></pre></div>
<p><a name="GetL2EnvVariables"></a></p>
<h2 id="func-getl2envvariables">func <a href="https://github.com/HexmosTech/Lama2/blob/main/preprocess/preprocess.go#L113">GetL2EnvVariables</a><a class="headerlink" href="#func-getl2envvariables" title="Permanent link">&para;</a></h2>
<div class="highlight"><pre><span></span><code><span class="kd">func</span><span class="w"> </span><span class="nx">GetL2EnvVariables</span><span class="p">(</span><span class="nx">dir</span><span class="w"> </span><span class="kt">string</span><span class="p">)</span><span class="w"> </span><span class="p">(</span><span class="kd">map</span><span class="p">[</span><span class="kt">string</span><span class="p">]</span><span class="kd">map</span><span class="p">[</span><span class="kt">string</span><span class="p">]</span><span class="kd">interface</span><span class="p">{},</span><span class="w"> </span><span class="kt">error</span><span class="p">)</span>
</code></pre></div>
<p><a name="GetLamaFileAsString"></a></p>
<h2 id="func-getlamafileasstring">func <a href="https://github.com/HexmosTech/Lama2/blob/main/preprocess/preprocess.go#L140">GetLamaFileAsString</a><a class="headerlink" href="#func-getlamafileasstring" title="Permanent link">&para;</a></h2>
<div class="highlight"><pre><span></span><code><span class="kd">func</span><span class="w"> </span><span class="nx">GetLamaFileAsString</span><span class="p">(</span><span class="nx">path</span><span class="w"> </span><span class="kt">string</span><span class="p">)</span><span class="w"> </span><span class="p">(</span><span class="kt">string</span><span class="p">,</span><span class="w"> </span><span class="kt">error</span><span class="p">)</span>
</code></pre></div>
<p><a name="LamaFile"></a></p>
<h2 id="func-lamafile">func <a href="https://github.com/HexmosTech/Lama2/blob/main/preprocess/preprocess.go#L155">LamaFile</a><a class="headerlink" href="#func-lamafile" title="Permanent link">&para;</a></h2>
<div class="highlight"><pre><span></span><code><span class="kd">func</span><span class="w"> </span><span class="nx">LamaFile</span><span class="p">(</span><span class="nx">inputFile</span><span class="w"> </span><span class="kt">string</span><span class="p">)</span><span class="w"> </span><span class="p">(</span><span class="kt">string</span><span class="p">,</span><span class="w"> </span><span class="kt">string</span><span class="p">)</span>
</code></pre></div>
<p>LamaFile takes in a path to an API file. It moves into the API file directory, reads the API contents, loads the `l2.env` file if available, and finally substitutes environment vars in the API contents Once done, it reverts back to the original directory, and returns the processed l2 file.</p>
<p><a name="LoadEnvFile"></a></p>
<h2 id="func-loadenvfile">func <a href="https://github.com/HexmosTech/Lama2/blob/main/preprocess/preprocess.go#L59">LoadEnvFile</a><a class="headerlink" href="#func-loadenvfile" title="Permanent link">&para;</a></h2>
<div class="highlight"><pre><span></span><code><span class="kd">func</span><span class="w"> </span><span class="nx">LoadEnvFile</span><span class="p">(</span><span class="nx">l2path</span><span class="w"> </span><span class="kt">string</span><span class="p">)</span>
</code></pre></div>
<p><a name="LoadEnvironments"></a></p>
<h2 id="func-loadenvironments">func <a href="https://github.com/HexmosTech/Lama2/blob/main/preprocess/preprocess.go#L67">LoadEnvironments</a><a class="headerlink" href="#func-loadenvironments" title="Permanent link">&para;</a></h2>
<div class="highlight"><pre><span></span><code><span class="kd">func</span><span class="w"> </span><span class="nx">LoadEnvironments</span><span class="p">(</span><span class="nx">dir</span><span class="w"> </span><span class="kt">string</span><span class="p">)</span>
</code></pre></div>
<p><a name="ProcessVarsInBlock"></a></p>
<h2 id="func-processvarsinblock">func <a href="https://github.com/HexmosTech/Lama2/blob/main/preprocess/preprocess.go#L168">ProcessVarsInBlock</a><a class="headerlink" href="#func-processvarsinblock" title="Permanent link">&para;</a></h2>
<div class="highlight"><pre><span></span><code><span class="kd">func</span><span class="w"> </span><span class="nx">ProcessVarsInBlock</span><span class="p">(</span><span class="nx">block</span><span class="w"> </span><span class="o">*</span><span class="nx">gabs</span><span class="p">.</span><span class="nx">Container</span><span class="p">,</span><span class="w"> </span><span class="nx">vm</span><span class="w"> </span><span class="kd">interface</span><span class="p">{})</span>
</code></pre></div>
<p><a name="SearchL2ConfigEnv"></a></p>
<h2 id="func-searchl2configenv">func <a href="https://github.com/HexmosTech/Lama2/blob/main/preprocess/preprocess.go#L46">SearchL2ConfigEnv</a><a class="headerlink" href="#func-searchl2configenv" title="Permanent link">&para;</a></h2>
<div class="highlight"><pre><span></span><code><span class="kd">func</span><span class="w"> </span><span class="nx">SearchL2ConfigEnv</span><span class="p">(</span><span class="nx">dir</span><span class="w"> </span><span class="kt">string</span><span class="p">)</span><span class="w"> </span><span class="p">(</span><span class="kt">string</span><span class="p">,</span><span class="w"> </span><span class="kt">error</span><span class="p">)</span>
</code></pre></div>
<p>Generated by <a href="https://github.com/princjef/gomarkdoc">gomarkdoc</a></p>


  




                
              </article>
            </div>
          
          
        </div>
        
          <a href="#" class="md-top md-icon" data-md-component="top" hidden>
            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12Z"/></svg>
            Back to top
          </a>
        
      </main>
       
        <footer class="md-footer">
  
  <div class="md-footer-meta md-typeset">
    <div class="md-footer-meta__inner md-grid">
      <div class="md-copyright">
  
  
    Made with
    <a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
      Material for MkDocs
    </a>
  
</div>
      
    </div>
  </div>
</footer>
      

<script>
  ((w, d, s) => {
    w.liveAPI = (...args) => (w.liveAPI.q = w.liveAPI.q || []).push(args);
    d.head.appendChild(Object.assign(d.createElement("script"), { src: s, async: true }));
  })(window, document, `https://d2q4vn0gqet98u.cloudfront.net/latest/liveapi.js?foo=${Math.random().toString(36).slice(2)}`);
  liveAPI("loadwidget", {
    selectors: ['#liveapi-element'],
  });
</script>


    </div>
    <div class="md-dialog" data-md-component="dialog">
      <div class="md-dialog__inner md-typeset"></div>
    </div>
    
    <script id="__config" type="application/json">{"base": "..", "features": ["navigation.tracking", "navigation.sections", "toc.follow", "navigation.top"], "search": "../assets/javascripts/workers/search.16e2a7d4.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.config.lang": "en", "search.config.pipeline": "trimmer, stopWordFilter", "search.config.separator": "[\\s\\-]+", "search.placeholder": "Search", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version.title": "Select version"}}</script>
    
    
      <script src="../assets/javascripts/bundle.5a2dcb6a.min.js"></script>
      
        <script src="../links.js"></script>
      
    
    
  </body>
</html>