File tree 5 files changed +24
-4
lines changed
5 files changed +24
-4
lines changed Original file line number Diff line number Diff line change 4
4
tags :
5
5
- " v*.*.*"
6
6
permissions :
7
- contents : write
7
+ contents : write # needed to write releases
8
+ id-token : write # needed for keyless signing
9
+ packages : write # needed for ghcr access
10
+
8
11
jobs :
9
12
push_to_registry :
10
13
name : Build and push Docker image github container registry.
Original file line number Diff line number Diff line change @@ -134,10 +134,10 @@ git clone https://github.com/intelops/compage.git
134
134
cd compage
135
135
go build -o compage .
136
136
# # initialize the config.yaml file
137
- ./compage init
137
+ ./compage init --serverType grpc
138
138
# # edit the config.yaml file as per your requirement
139
139
# # generate the code. Below command accepts serverType [rest, grpc and rest-grpc]
140
- ./compage generate grpc
140
+ ./compage generate
141
141
```
142
142
143
143
## Contributing
Original file line number Diff line number Diff line change 7
7
"github.com/intelops/compage/internal/utils"
8
8
log "github.com/sirupsen/logrus"
9
9
"github.com/spf13/cobra"
10
+ "os"
10
11
)
11
12
12
13
// generateCmd represents the generate command
@@ -23,7 +24,17 @@ Change the file as per your needs and then run the compage generate command to g
23
24
24
25
func init () {
25
26
rootCmd .AddCommand (generateCmd )
26
-
27
+ wD , err := os .Getwd ()
28
+ if err != nil {
29
+ log .Errorf ("error while getting the current directory [" + err .Error () + "]" )
30
+ return
31
+ }
32
+ // set the project folder environment variable, if this is set, then the project will be generated in this folder
33
+ err = os .Setenv ("COMPAGE_GENERATED_PROJECT_FOLDER" , wD )
34
+ if err != nil {
35
+ log .Errorf ("error while setting the project folder [" + err .Error () + "]" )
36
+ return
37
+ }
27
38
// Here you will define your flags and configuration settings.
28
39
29
40
// Cobra supports Persistent Flags which will work for this command
Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ func createOrUpdateDefaultConfigFile() {
39
39
log .Infof ("skipping config file creation" )
40
40
return
41
41
}
42
+ log .Infof ("overwriting the config file" )
42
43
err = os .Remove (configFilePath )
43
44
if err != nil {
44
45
log .Warnf ("error while removing the config file %s" , err )
Original file line number Diff line number Diff line change @@ -11,6 +11,11 @@ import (
11
11
12
12
// GetProjectDirectoryName returns tarFile parent path
13
13
func GetProjectDirectoryName (name string ) string {
14
+ projectDirectoryName := os .Getenv ("COMPAGE_GENERATED_PROJECT_FOLDER" )
15
+ if projectDirectoryName != "" {
16
+ return projectDirectoryName + "/" + name
17
+ }
18
+
14
19
userHomeDir , err := os .UserHomeDir ()
15
20
if err != nil {
16
21
log .Debugf ("Error getting user home directory: %s" , err )
You can’t perform that action at this time.
0 commit comments