Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

generate a random string #42

Closed
pk11 opened this Issue · 5 comments

2 participants

@pk11

Hi Nathan,

g8 is awesome, we have just one issue.

in play apps, there is a configuration field called application.secret that lets you define your app's private key which is used for security.

Right now what we do is create a variable (application_secret) with the value CHANGEME12345678 but what would be great is to be able to generate a random string like

  val random = new java.security.SecureRandom
  val newSecret = (1 to 64).map { _ =>
    (random.nextInt(74) + 48).toChar
  }.mkString.replaceAll("\\\\+", "/")

for a special key $RANDOM$

or if that's breaking the current design then defining a formatter called random which would attach a random string to your base string would also be perfect!
ie
$name;format="random"$

@pk11

(I can send a pull request if needed for the random formatter solution)

@n8han
Owner

yeah a pull request will make it happen faster :)

@pk11

I just sent you a pull request, hope it looks OK. Thanks!

@n8han
Owner

Thanks, I just added this to the readme:

random | generate-random : appends random characters to the given string

@n8han n8han closed this
@pk11

excellent - thanks Nathan!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.