-
Notifications
You must be signed in to change notification settings - Fork 2
/
CFG.cs
79 lines (62 loc) · 1.98 KB
/
CFG.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
using System;
using System.Collections.Generic;
using System.IO;
using Newtonsoft.Json.Linq;
using Renci.SshNet;
namespace akash_dep
{
public static class CFG
{
public static String AKASH_NODE;
public static String AKASH_EXE;
public static String AKASH_KEYRING_BACKEND;
public static String AKASH_NET;
public static String AKASH_VERSION;
public static String AKASH_CHAIN_ID;
public static EnvVarsReplacer m_replacer = new EnvVarsReplacer();
public static ClientSSH ssh = new ClientSSH();
public static void Connect()
{
ssh.Connect();
}
public static void LoadCfg(JToken cfg)
{
ssh.LoadCfg(cfg);
AKASH_NODE = cfg["AKASH_NODE"].ToString();
AKASH_EXE = cfg["AKASH_EXE"].ToString();
AKASH_KEYRING_BACKEND = cfg["AKASH_KEYRING_BACKEND"].ToString();
AKASH_NET = cfg["AKASH_NET"].ToString();
AKASH_VERSION = cfg["AKASH_VERSION"].ToString();
AKASH_CHAIN_ID = cfg["AKASH_CHAIN_ID"].ToString();
}
public static void PushAkash(String cmd)
{
ssh.Push(CFG.AKASH_EXE + " " + cmd);
}
public static void Push(String cmd)
{
ssh.Push(cmd);
}
public static String Send()
{
return ssh.Send();
}
public static void Clear()
{
ssh.Clear();
}
public static String Prepare(String val)
{
return m_replacer.Prepare(val);
}
public static void EvalVars()
{
m_replacer.Add("AKASH_NET", AKASH_NET);
m_replacer.Evaluate("AKASH_NODE", AKASH_NODE);
m_replacer.Evaluate("AKASH_VERSION", AKASH_VERSION);
m_replacer.Evaluate("AKASH_CHAIN_ID", AKASH_CHAIN_ID);
m_replacer.Add("AKASH_KEYRING_BACKEND", AKASH_KEYRING_BACKEND);
m_replacer.Print();
}
}
}