| giolekva | 8aa73e8 | 2022-07-09 11:34:39 +0400 | [diff] [blame] | 1 | package soft |
| 2 | |
| 3 | type Repository struct { |
| 4 | Name string `json:"name"` |
| 5 | Repository string `json:"repo"` |
| 6 | Private bool `json:"private"` |
| 7 | Note string `json:"note"` |
| 8 | } |
| 9 | |
| 10 | type User struct { |
| 11 | Name string `json:"name"` |
| 12 | Admin bool `json:"admin"` |
| 13 | PublicKeys []string `json:"public-keys"` |
| 14 | } |
| 15 | |
| 16 | type Config struct { |
| 17 | Name string `json:"name"` |
| 18 | Host string `json:"host"` |
| 19 | Port int `json:"port"` |
| 20 | AnonAccess string `json:"anon-access"` |
| 21 | AllowKeyless bool `json:"allow-keyless"` |
| 22 | Repositories []Repository `json:"repos"` |
| 23 | Users []User `json:"users"` |
| 24 | } |
| 25 | |
| 26 | func DefaultConfig(adminKeys []string) Config { |
| 27 | return Config{ |
| 28 | Name: "PCloud", |
| 29 | Host: "localhost", |
| 30 | Port: 22, |
| 31 | AnonAccess: "no-access", |
| 32 | AllowKeyless: false, |
| 33 | Repositories: []Repository{ |
| 34 | { |
| 35 | Name: "Home", |
| 36 | Repository: "config", |
| 37 | Private: true, |
| 38 | Note: "Configuration for PCloud SoftServe deployment", |
| 39 | }, |
| 40 | }, |
| 41 | Users: []User{ |
| 42 | { |
| 43 | Name: "Admin", |
| 44 | Admin: true, |
| 45 | PublicKeys: adminKeys, |
| 46 | }, |
| 47 | }, |
| 48 | } |
| 49 | } |