2016-05-31 17:00:52 +00:00
|
|
|
import "typings-global";
|
|
|
|
import * as plugins from "./smartssh.plugins";
|
|
|
|
import * as helpers from "./smartssh.classes.helpers";
|
2016-06-24 18:58:55 +00:00
|
|
|
import {SshKey} from "./smartssh.classes.sshkey"
|
|
|
|
|
2016-05-31 17:16:45 +00:00
|
|
|
export class SshConfig {
|
2016-06-24 18:58:55 +00:00
|
|
|
sshKeyArray:SshKey[];
|
2016-06-25 00:10:53 +00:00
|
|
|
config:configObject[];
|
2016-06-24 18:58:55 +00:00
|
|
|
constructor(sshKeyArrayArg:SshKey[]){
|
|
|
|
this.sshKeyArray = sshKeyArrayArg;
|
2016-06-25 00:10:53 +00:00
|
|
|
this.config = [];
|
2016-06-24 18:58:55 +00:00
|
|
|
}
|
|
|
|
makeConfig(){
|
2016-06-25 00:10:53 +00:00
|
|
|
// clear old config in place
|
|
|
|
let configLength = this.config.length;
|
|
|
|
for(let i = 0; i < configLength; i++){
|
|
|
|
this.config.pop();
|
|
|
|
}
|
|
|
|
for(let key in this.sshKeyArray){
|
|
|
|
let localSshKey = this.sshKeyArray[key];
|
|
|
|
this.config.push({
|
|
|
|
host: localSshKey.host,
|
|
|
|
authorized: localSshKey.authorized,
|
|
|
|
sshKey: localSshKey
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
storeConfig(){
|
|
|
|
|
2016-05-31 17:00:52 +00:00
|
|
|
}
|
2016-06-25 00:10:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
interface configObject {
|
|
|
|
host:string;
|
|
|
|
authorized:boolean;
|
|
|
|
sshKey:SshKey;
|
|
|
|
};
|
|
|
|
|