-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Finish based cicd to deploy to dev * Change CICD flow * fix: Add github workspace * update workspace * Fix CIC * update * Remove option -v on test golang * update CICD Co-authored-by: thaibx <[email protected]> * test * Testme (#7) * test * test Co-authored-by: thaibx <[email protected]> * change cicd flow * Test (#8) * test * change cicd flow * update trigger push tags Co-authored-by: thaibx <[email protected]> * feat/add-oauth-client-support-drive feat/add-oauth-client-support-drive * feat/add prelaod lock * add exg tool for pre-generate token Co-authored-by: thaibx <[email protected]>
- Loading branch information
Showing
16 changed files
with
258 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
### Google token exchange | ||
Addtional tool to pre-generate token use for proxy-server | ||
#### Build And Run | ||
|
||
On linux: | ||
* Build: | ||
```shell | ||
go build -o exg additional-tools/google_token_exchange/main.go | ||
|
||
``` | ||
|
||
* Run: | ||
```shell | ||
./exg | ||
``` | ||
|
||
* You can get binary file [exg-bin](../../bin/exg) | ||
|
||
* Follow instructions in console to get exchange token | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package main | ||
|
||
import ( | ||
"golang.org/x/oauth2/google" | ||
"google.golang.org/api/drive/v3" | ||
"io/ioutil" | ||
"proxy-fileserver/adapter" | ||
"proxy-fileserver/common/config" | ||
"proxy-fileserver/common/log" | ||
"proxy-fileserver/configs" | ||
) | ||
|
||
func _initLogger() log.Logging { | ||
logger, err := log.NewLogger() | ||
if err != nil { | ||
panic("Error when init logger") | ||
} | ||
log.RegisterGlobal(logger) | ||
return logger | ||
} | ||
|
||
func main() { | ||
config.LoadEnvironments() | ||
configs.LoadConfigs() | ||
conf := configs.Get() | ||
_initLogger() | ||
credentials, err := ioutil.ReadFile(conf.GoogleDriveOAuthConfig.CredentialFile) | ||
if err != nil { | ||
panic(err) | ||
} | ||
gConfig, err := google.ConfigFromJSON(credentials, drive.DriveReadonlyScope, drive.DriveMetadataScope) | ||
if err != nil { | ||
panic(err) | ||
} | ||
_ = adapter.GetDriveClient(gConfig, conf.GoogleDriveOAuthConfig.TokenFile, true) | ||
log.Infof("You can find your access token in token.json file at %v.\n"+ | ||
"Please delete token file before run this tool if you want to generate new new token", conf.GoogleDriveOAuthConfig.TokenFile) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package enums | ||
|
||
const ( | ||
StateToken = "random-string-abc356" | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.