Skip to content

Commit

Permalink
Add a random number templating function (close #109)
Browse files Browse the repository at this point in the history
  • Loading branch information
tclass authored and mhadam committed Jul 6, 2018
1 parent bddd4d6 commit f52929d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sql_runner/db.go
Expand Up @@ -14,7 +14,9 @@ package main

import (
"bytes"
"math/rand"
"os"
"strconv"
"text/template"
"time"
)
Expand All @@ -27,6 +29,10 @@ var (
"systemEnv": func(env string) string {
return os.Getenv(env)
},
"randomInt": func() (string, error) {
r := rand.NewSource(time.Now().UnixNano())
return strconv.FormatInt(r.Int63(), 10), nil
},
"awsChainCredentials": awsChainCredentials,
"awsEC2RoleCredentials": awsEC2RoleCredentials,
"awsEnvCredentials": awsEnvCredentials,
Expand Down

0 comments on commit f52929d

Please sign in to comment.