config.force_ssl = true
- config.uuid_prefix = Digest::MD5.hexdigest('CHANGE-ME').to_i(16).to_s(36)[0..4]
+ def config.uuid_prefix(x=nil)
+ if x and @uuid_prefix
+ raise "uuid_prefix was already set to #{@uuid_prefix}"
+ end
+ @uuid_prefix ||= Digest::MD5.hexdigest(x || `hostname`.strip).to_i(16).to_s(36)[-5..-1]
+ end
+ def config.uuid_prefix=(x)
+ @uuid_prefix = x
+ end
end
end
# config.compute_node_nameservers = ['1.2.3.4', '1.2.3.5']
config.compute_node_nameservers = ['192.168.201.3']
+
+ config.uuid_prefix('development@' + `hostname`.strip)
end
config.compute_node_nameservers = ['local', 'public'].collect do |iface|
Net::HTTP.get(URI("http://169.254.169.254/latest/meta-data/#{iface}-ipv4")).match(/^[\d\.]+$/)[0]
end << '172.16.0.23'
+
+ config.uuid_prefix = Digest::MD5.hexdigest('cfi-aws-0').to_i(16).to_s(36)[0..4] # '9ujm1'
end
config.compute_node_nameservers = ['local', 'public'].collect do |iface|
Net::HTTP.get(URI("http://169.254.169.254/latest/meta-data/#{iface}-ipv4")).match(/^[\d\.]+$/)[0]
end << '172.16.0.23'
+
+ config.uuid_prefix('test@' + `hostname`.strip)
end
module ClassMethods
def uuid_prefix
- Digest::MD5.hexdigest(self.to_s).to_i(16).to_s(36)[0..4]
+ Digest::MD5.hexdigest(self.to_s).to_i(16).to_s(36)[-5..-1]
end
end
return true if !self.respond_to_uuid?
self.uuid ||= [Server::Application.config.uuid_prefix,
self.class.uuid_prefix,
- rand(2**256).to_s(36)[0..14]].
+ rand(2**256).to_s(36)[-15..-1]].
join '-'
end
end