Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $chars = [*(0..9).to_a, *('a'..'z').to_a, *('A'..'Z').to_a]
- $lengths = {
- username: 14,
- password: 26,
- db_name: 14
- }
- def random_chars length
- length.times.map do
- $chars.sample
- end.join
- end
- chars = $lengths.map { |_, v| random_chars(v) }
- url = 'postgres://%s:%s@host:5432/%s' % chars
- puts url
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement