@@ -45,9 +45,9 @@ Adds a repository to the system. URLs, local files or inline repo can be specifi
45
45
46
46
luet repo add ... --name "foo"
47
47
48
- # Inline:
48
+ # Inline (provided you have $PASSWORD environent variable set) :
49
49
50
- luet repo add testfo --description "Bar" --url "FOZZ" --type "ff"
50
+ luet repo add testfo --description "Bar" --url "FOZZ" --type "ff" --username "user" --passwd $(echo "$PASSWORD")
51
51
52
52
` ,
53
53
Run : func (cmd * cobra.Command , args []string ) {
@@ -61,6 +61,8 @@ Adds a repository to the system. URLs, local files or inline repo can be specifi
61
61
url , _ := cmd .Flags ().GetString ("url" )
62
62
ref , _ := cmd .Flags ().GetString ("reference" )
63
63
prio , _ := cmd .Flags ().GetInt ("priority" )
64
+ username , _ := cmd .Flags ().GetString ("username" )
65
+ passwd , _ := cmd .Flags ().GetString ("passwd" )
64
66
65
67
if len (util .DefaultContext .Config .RepositoriesConfDir ) == 0 && d == "" {
66
68
util .DefaultContext .Fatal ("No repository dirs defined" )
@@ -82,6 +84,10 @@ Adds a repository to the system. URLs, local files or inline repo can be specifi
82
84
Type : t ,
83
85
Urls : []string {url },
84
86
Priority : prio ,
87
+ Authentication : map [string ]string {
88
+ "username" : username ,
89
+ "password" : passwd ,
90
+ },
85
91
}
86
92
} else {
87
93
r , err = types .LoadRepository ([]byte (str ))
@@ -103,6 +109,12 @@ Adds a repository to the system. URLs, local files or inline repo can be specifi
103
109
if prio != 0 {
104
110
r .Priority = prio
105
111
}
112
+ if username != "" && passwd != "" {
113
+ r .Authentication = map [string ]string {
114
+ "username" : username ,
115
+ "password" : passwd ,
116
+ }
117
+ }
106
118
}
107
119
108
120
file := filepath .Join (util .DefaultContext .Config .System .Rootfs , d , fmt .Sprintf ("%s.yaml" , r .Name ))
@@ -133,5 +145,7 @@ Adds a repository to the system. URLs, local files or inline repo can be specifi
133
145
cmd .Flags ().String ("url" , "" , "Repository URL" )
134
146
cmd .Flags ().String ("reference" , "" , "Repository Reference ID" )
135
147
cmd .Flags ().IntP ("priority" , "p" , 99 , "repository prio" )
148
+ cmd .Flags ().String ("username" , "" , "repository username" )
149
+ cmd .Flags ().String ("passwd" , "" , "repository password" )
136
150
return cmd
137
151
}
0 commit comments