Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generate a random string #42

Closed
pk11 opened this issue Mar 21, 2012 · 5 comments
Closed

generate a random string #42

pk11 opened this issue Mar 21, 2012 · 5 comments

Comments

@pk11
Copy link
Contributor

pk11 commented Mar 21, 2012

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
Copy link
Contributor Author

pk11 commented Mar 21, 2012

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

@n8han
Copy link

n8han commented Mar 23, 2012

yeah a pull request will make it happen faster :)

@pk11
Copy link
Contributor Author

pk11 commented Apr 3, 2012

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

@n8han
Copy link

n8han commented Apr 3, 2012

Thanks, I just added this to the readme:

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

@n8han n8han closed this as completed Apr 3, 2012
@pk11
Copy link
Contributor Author

pk11 commented Apr 3, 2012

excellent - thanks Nathan!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants