2016-05-31 19:00:52 +02:00
|
|
|
import "typings-global";
|
|
|
|
import * as plugins from "./smartssh.plugins";
|
|
|
|
import * as helpers from "./smartssh.classes.helpers";
|
2016-06-24 20:58:55 +02:00
|
|
|
import {SshKey} from "./smartssh.classes.sshkey"
|
|
|
|
|
2016-05-31 19:16:45 +02:00
|
|
|
export class SshConfig {
|
2016-06-24 20:58:55 +02:00
|
|
|
sshKeyArray:SshKey[];
|
2016-06-25 02:10:53 +02:00
|
|
|
config:configObject[];
|
2016-06-24 20:58:55 +02:00
|
|
|
constructor(sshKeyArrayArg:SshKey[]){
|
|
|
|
this.sshKeyArray = sshKeyArrayArg;
|
2016-06-25 02:10:53 +02:00
|
|
|
this.config = [];
|
2016-06-24 20:58:55 +02:00
|
|
|
}
|
|
|
|
makeConfig(){
|
2016-06-25 02:10:53 +02: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 19:00:52 +02:00
|
|
|
}
|
2016-06-25 02:10:53 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
interface configObject {
|
|
|
|
host:string;
|
|
|
|
authorized:boolean;
|
|
|
|
sshKey:SshKey;
|
|
|
|
};
|
|
|
|
|