github.com/theliebeskind/genfig@v0.1.5-alpha/example/config/plugin_write_to_env.go (about)

     1  // Code generated by genfig plugin 'write_to_env' on 2019-07-24T22:16:50+02:00; DO NOT EDIT.
     2  
     3  package config
     4  
     5  import (
     6  	"encoding/json"
     7  	"fmt"
     8  	"os"
     9  )
    10  
    11  var (
    12  	_ = os.Setenv
    13  	_ = fmt.Sprintf
    14  	_ = json.Marshal
    15  )
    16  
    17  func (c *Config) WriteToEnv() {
    18  	var buf []byte
    19  	_ = buf
    20  
    21  	_ = os.Setenv("APIS_GOOGLE_URI", fmt.Sprintf("%v", c.Apis.Google.Uri))
    22  
    23  	_ = os.Setenv("DB_PASS", fmt.Sprintf("%v", c.Db.Pass))
    24  
    25  	_ = os.Setenv("DB_URI", fmt.Sprintf("%v", c.Db.Uri))
    26  
    27  	_ = os.Setenv("DB_USER", fmt.Sprintf("%v", c.Db.User))
    28  
    29  	_ = os.Setenv("LONGDESC_DE", fmt.Sprintf("%v", c.LongDesc.De))
    30  
    31  	_ = os.Setenv("LONGDESC_EN", fmt.Sprintf("%v", c.LongDesc.En))
    32  
    33  	_ = os.Setenv("PROJECT", fmt.Sprintf("%v", c.Project))
    34  
    35  	_ = os.Setenv("RANDOMIZER_THRESHOLD", fmt.Sprintf("%v", c.Randomizer.Threshold))
    36  
    37  	buf, _ = json.Marshal(c.Secrets)
    38  	_ = os.Setenv("SECRETS", string(buf))
    39  
    40  	_ = os.Setenv("SERVER_HOST", fmt.Sprintf("%v", c.Server.Host))
    41  
    42  	_ = os.Setenv("SERVER_PORT", fmt.Sprintf("%v", c.Server.Port))
    43  
    44  	_ = os.Setenv("VERSION", fmt.Sprintf("%v", c.Version))
    45  
    46  	_ = os.Setenv("WIP", fmt.Sprintf("%v", c.Wip))
    47  
    48  }