(kind DockerConfigKind, form *tview.Form)
| 45 | } |
| 46 | |
| 47 | func (i *MystConfig) ConfigureDocker(kind DockerConfigKind, form *tview.Form) (string, error) { |
| 48 | switch kind { |
| 49 | case KIND_DOCKER_COMPOSE: |
| 50 | return `myst: |
| 51 | image: ` + MYST_IMAGE_NAME + ` |
| 52 | environment: |
| 53 | - MYSTNODE_DUMMY='' |
| 54 | command: service --agreed-terms-and-conditions |
| 55 | network_mode: host |
| 56 | cap_add: |
| 57 | - NET_ADMIN |
| 58 | ports: |
| 59 | - "4449:4449" |
| 60 | volumes: |
| 61 | - myst-data:/var/lib/mysterium-node |
| 62 | restart: unless-stopped |
| 63 | `, nil |
| 64 | case KIND_DIRECTLY_CONFIGURE_DOCKER: |
| 65 | containerConfig := &container.Config{ |
| 66 | Image: MYST_IMAGE_NAME, |
| 67 | Env: []string{ |
| 68 | "MYSTNODE_DUMMY=", |
| 69 | }, |
| 70 | Cmd: []string{"service", "--agreed-terms-and-conditions"}, |
| 71 | Volumes: map[string]struct{}{ |
| 72 | "/var/lib/mysterium-node": {}, |
| 73 | }, |
| 74 | } |
| 75 | hostConfig := &container.HostConfig{ |
| 76 | RestartPolicy: container.RestartPolicy{ |
| 77 | Name: "unless-stopped", |
| 78 | }, |
| 79 | CapAdd: []string{"NET_ADMIN"}, |
| 80 | NetworkMode: "host", |
| 81 | PortBindings: map[nat.Port][]nat.PortBinding{ |
| 82 | nat.Port("4449/tcp"): { |
| 83 | { |
| 84 | HostPort: "4449", |
| 85 | }, |
| 86 | }, |
| 87 | }, |
| 88 | } |
| 89 | return "", createContainer("myst", containerConfig, hostConfig, form) |
| 90 | } |
| 91 | return "", errors.New("unknown kind") |
| 92 | } |
| 93 | |
| 94 | func (i *MystConfig) IsConfigured() bool { |
| 95 | return i.Configured |
nothing calls this directly
no test coverage detected