|
|
@ -1,7 +1,12 @@ |
|
|
|
package main |
|
|
|
package main |
|
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
import ( |
|
|
|
|
|
|
|
"database/sql" |
|
|
|
"fmt" |
|
|
|
"fmt" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/uptrace/bun" |
|
|
|
|
|
|
|
"github.com/uptrace/bun/dialect/pgdialect" |
|
|
|
|
|
|
|
"github.com/uptrace/bun/driver/pgdriver" |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
// Tofu Provider is the goal
|
|
|
|
// Tofu Provider is the goal
|
|
|
@ -19,24 +24,13 @@ import ( |
|
|
|
func main() { |
|
|
|
func main() { |
|
|
|
var ( |
|
|
|
var ( |
|
|
|
pgdsn = "postgres://postgres:Initial1@localhost:15432/anvil?sslmode=disable" |
|
|
|
pgdsn = "postgres://postgres:Initial1@localhost:15432/anvil?sslmode=disable" |
|
|
|
sshdsn = "192.168.1.165:22" |
|
|
|
|
|
|
|
// webdsn = "http://192.168.1.165"
|
|
|
|
|
|
|
|
) |
|
|
|
) |
|
|
|
anvil := new(Anvil) |
|
|
|
anvil := new(Anvil) |
|
|
|
anvil.AddStriker(Striker{}) |
|
|
|
anvil.AddStriker(Striker{}) |
|
|
|
// anvil.Strikers[0].SetFQDN("mh-striker01.libre.audio")
|
|
|
|
// anvil.Strikers[0].SetFQDN("mh-striker01.libre.audio")
|
|
|
|
pge := &PostgresClient{OpenDB(pgdsn)} |
|
|
|
e := &PostgresClient{bun.NewDB(sql.OpenDB(pgdriver.NewConnector(pgdriver.WithDSN(pgdsn))), pgdialect.New())} |
|
|
|
anvil.Strikers[0].AddEndpoint(pge) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
webe := &WebClient{OpenHTTP()} |
|
|
|
|
|
|
|
anvil.Strikers[0].AddEndpoint(webe) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sshe := &SSHClient{OpenSSH(sshdsn)} |
|
|
|
|
|
|
|
anvil.Strikers[0].AddEndpoint(sshe) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
anvil.Strikers[0].AddEndpoint(e) |
|
|
|
fmt.Printf("Strikers[0].Endpoints.PostgresClient = %s.\n", anvil.Strikers[0].Endpoints.PostgresClient) |
|
|
|
fmt.Printf("Strikers[0].Endpoints.PostgresClient = %s.\n", anvil.Strikers[0].Endpoints.PostgresClient) |
|
|
|
fmt.Printf("Strikers[0].Endpoints.WebClient = %s.\n", anvil.Strikers[0].Endpoints.WebClient) |
|
|
|
|
|
|
|
fmt.Printf("Strikers[0].Endpoints.SSHClient = %s.\n", anvil.Strikers[0].Endpoints.SSHClient) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// fmt.Printf("Strikers[0].FQDN = %s.\n", anvil.Strikers[0].FQDN)
|
|
|
|
// fmt.Printf("Strikers[0].FQDN = %s.\n", anvil.Strikers[0].FQDN)
|
|
|
|
} |
|
|
|
} |
|
|
|