|
|
|
@ -1,12 +1,7 @@ |
|
|
|
|
package main |
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
|
"database/sql" |
|
|
|
|
"fmt" |
|
|
|
|
|
|
|
|
|
"github.com/uptrace/bun" |
|
|
|
|
"github.com/uptrace/bun/dialect/pgdialect" |
|
|
|
|
"github.com/uptrace/bun/driver/pgdriver" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
// Tofu Provider is the goal
|
|
|
|
@ -23,14 +18,25 @@ import ( |
|
|
|
|
|
|
|
|
|
func main() { |
|
|
|
|
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.AddStriker(Striker{}) |
|
|
|
|
// anvil.Strikers[0].SetFQDN("mh-striker01.libre.audio")
|
|
|
|
|
e := &PostgresClient{bun.NewDB(sql.OpenDB(pgdriver.NewConnector(pgdriver.WithDSN(pgdsn))), pgdialect.New())} |
|
|
|
|
pge := &PostgresClient{OpenDB(pgdsn)} |
|
|
|
|
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.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)
|
|
|
|
|
} |
|
|
|
|