Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module.exports.DSN = function() {
- this.setPath = function(path) {
- this.path = path;
- };
- this.getPath = function() {
- return this.path;
- };
- this.getPort = function() {
- return this.port;
- };
- this.setPort = function(port) {
- this.port = port;
- };
- this.setHost = function(host) {
- this.host = host;
- }
- this.getHost = function() {
- return this.host;
- };
- this.setProtocol = function(proto) {
- this.proto = proto;
- };
- this.getProtocol = function() {
- return this.proto;
- };
- this.setUsername = function(user) {
- this.user = user;
- };
- this.getUsername = function() {
- return this.user;
- };
- this.setPass = function(pass) {
- this.pass = pass;
- };
- this.getPass = function() {
- return this.pass;
- };
- this.toString = function() {
- if (this.host === undefined) {
- return; // There is no host, we can't do anything
- }
- var result = this.host;
- if (this.port !== undefined) {
- result += ":" + this.port;
- }
- if (this.path !== undefined) {
- result += "/" + this.path;
- }
- var userString = "";
- if (this.user !== undefined) {
- userString = this.user;
- }
- if (this.pass !== undefined) {
- userString += ":" + this.pass;
- }
- if (userString !== "") {
- result = userString + "@" + result;
- }
- if (this.proto !== undefined) {
- result = this.proto + "://" + result;
- }
- return result;
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement