@@ -42,70 +42,70 @@ type delims struct {
4242 right string
4343}
4444
45- func (ctx * Context ) identifier () string {
46- if ctx .RepoUrl == "" {
45+ func (c * Context ) identifier () string {
46+ if c .RepoUrl == "" {
4747 return ""
4848 }
4949
50- if strings .HasPrefix (ctx .RepoUrl , "http" ) {
51- parsed , err := giturls .Parse (ctx .RepoUrl )
50+ if strings .HasPrefix (c .RepoUrl , "http" ) {
51+ parsed , err := giturls .Parse (c .RepoUrl )
5252 if err == nil {
5353 return strings .TrimSuffix (strings .TrimPrefix (parsed .Path , "/" ), ".git" )
5454 }
5555 }
5656
57- split := strings .Split (ctx .RepoUrl , ":" )
57+ split := strings .Split (c .RepoUrl , ":" )
5858 return strings .TrimSuffix (split [len (split )- 1 ], ".git" )
5959}
6060
61- func (ctx * Context ) changeDelims () {
62- ctx .Delims = & delims {"[[" , "]]" }
61+ func (c * Context ) changeDelims () {
62+ c .Delims = & delims {"[[" , "]]" }
6363}
6464
65- func (ctx * Context ) IgnorePreflights (ignore bool ) {
66- ctx .ignorePreflights = ignore
65+ func (c * Context ) IgnorePreflights (ignore bool ) {
66+ c .ignorePreflights = ignore
6767}
6868
69- func (ctx * Context ) SetImportCluster (id string ) {
70- ctx .ImportCluster = lo .ToPtr (id )
69+ func (c * Context ) SetImportCluster (id string ) {
70+ c .ImportCluster = lo .ToPtr (id )
7171}
7272
73- func (ctx * Context ) Backfill () error {
73+ func (c * Context ) Backfill () error {
7474 context , err := manifest .FetchContext ()
7575 if err != nil {
76- return ctx .backfillConsoleContext (ctx .Manifest )
76+ return c .backfillConsoleContext (c .Manifest )
7777 }
7878
7979 console , ok := context .Configuration ["console" ]
8080 if ! ok {
81- return ctx .backfillConsoleContext (ctx .Manifest )
81+ return c .backfillConsoleContext (c .Manifest )
8282 }
8383
8484 _ , hasSSH := console ["private_key" ]
8585 _ , hasHTTPS := console ["git_password" ]
8686 if ! hasSSH && ! hasHTTPS {
87- return ctx .backfillConsoleContext (ctx .Manifest )
87+ return c .backfillConsoleContext (c .Manifest )
8888 }
8989
9090 if v , ok := console ["repo_url" ]; ok {
9191 if r , ok := v .(string ); ok {
92- ctx .RepoUrl = r
92+ c .RepoUrl = r
9393 }
9494 }
9595
9696 if v , ok := console ["git_username" ]; ok {
9797 if s , ok := v .(string ); ok {
98- ctx .GitUsername = s
98+ c .GitUsername = s
9999 }
100100 }
101101
102102 if v , ok := console ["git_password" ]; ok {
103103 if s , ok := v .(string ); ok {
104- ctx .GitPassword = s
104+ c .GitPassword = s
105105 }
106106 }
107107
108- if ctx .RepoUrl == "" {
108+ if c .RepoUrl == "" {
109109 return fmt .Errorf ("you never configured a repoUrl for your workspace, check `context.yaml`" )
110110 }
111111
@@ -133,7 +133,7 @@ func Build(cloud bool) (*Context, error) {
133133 }, nil
134134}
135135
136- func (context * Context ) backfillConsoleContext (_ * manifest.ProjectManifest ) error {
136+ func (c * Context ) backfillConsoleContext (_ * manifest.ProjectManifest ) error {
137137 path := manifest .ContextPath ()
138138 ctx , err := manifest .FetchContext ()
139139 if err != nil {
@@ -153,13 +153,13 @@ func (context *Context) backfillConsoleContext(_ *manifest.ProjectManifest) erro
153153 }
154154
155155 if strings .HasPrefix (url , "http" ) {
156- return context .backfillHTTPS (url , console , ctx , path )
156+ return c .backfillHTTPS (url , console , ctx , path )
157157 }
158158
159- return context .backfillSSH (url , console , ctx , path )
159+ return c .backfillSSH (url , console , ctx , path )
160160}
161161
162- func (context * Context ) backfillSSH (url string , console map [string ]interface {}, ctx * manifest.Context , path string ) error {
162+ func (c * Context ) backfillSSH (url string , console map [string ]interface {}, ctx * manifest.Context , path string ) error {
163163 utils .Highlight ("If you want, you can use `plural crypto ssh-keygen` to generate a keypair to use as a deploy key as well\n \n " )
164164
165165 files , err := filepath .Glob (filepath .Join (os .Getenv ("HOME" ), ".ssh" , "*" ))
@@ -188,7 +188,7 @@ func (context *Context) backfillSSH(url string, console map[string]interface{},
188188 return err
189189 }
190190
191- if ! context .ignorePreflights {
191+ if ! c .ignorePreflights {
192192 if err := verifySSHKey (contents , url ); err != nil {
193193 return fmt .Errorf ("ssh key not valid for url %s, error: %w. If you want to bypass this check, you can use the --ignore-preflights flag" , url , err )
194194 }
@@ -197,11 +197,11 @@ func (context *Context) backfillSSH(url string, console map[string]interface{},
197197 console ["repo_url" ] = url
198198 console ["private_key" ] = contents
199199 ctx .Configuration ["console" ] = console
200- context .RepoUrl = url
200+ c .RepoUrl = url
201201 return ctx .Write (path )
202202}
203203
204- func (context * Context ) backfillHTTPS (url string , console map [string ]interface {}, ctx * manifest.Context , path string ) error {
204+ func (c * Context ) backfillHTTPS (url string , console map [string ]interface {}, ctx * manifest.Context , path string ) error {
205205 utils .Highlight ("If you want, you can also reclone with an SSH URL and re-run to use deploy-key authentication instead\n \n " )
206206
207207 var username , token string
@@ -219,7 +219,7 @@ func (context *Context) backfillHTTPS(url string, console map[string]interface{}
219219 return err
220220 }
221221
222- if ! context .ignorePreflights {
222+ if ! c .ignorePreflights {
223223 if err := verifyHTTPS (username , token , url ); err != nil {
224224 return fmt .Errorf ("PAT not valid for url %s, error: %w. If you want to bypass this check, you can use the --ignore-preflights flag" , url , err )
225225 }
@@ -229,9 +229,9 @@ func (context *Context) backfillHTTPS(url string, console map[string]interface{}
229229 console ["git_username" ] = username
230230 console ["git_password" ] = token
231231 ctx .Configuration ["console" ] = console
232- context .RepoUrl = url
233- context .GitUsername = username
234- context .GitPassword = token
232+ c .RepoUrl = url
233+ c .GitUsername = username
234+ c .GitPassword = token
235235 return ctx .Write (path )
236236}
237237
0 commit comments