-
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.
Merge branch 'main' into dependabot/go_modules/backend/backend-a65363…
…64df
- Loading branch information
Showing
87 changed files
with
3,417 additions
and
20,347 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,25 @@ | ||
package config | ||
|
||
import "time" | ||
import ( | ||
"fmt" | ||
"time" | ||
) | ||
|
||
type CalendarSettings struct { | ||
MaxTerminationDate time.Time | ||
} | ||
|
||
type intermediateCalendarSettings struct { | ||
MaxTerminationDate string `env:"MAX_TERMINATION_DATE"` | ||
maxTerminationDate string `env:"MAX_TERMINATION_DATE"` | ||
} | ||
|
||
func (i *intermediateCalendarSettings) into() (*CalendarSettings, error) { | ||
t, err := time.Parse("01-02-2006", i.MaxTerminationDate) | ||
maxTerminationDate, err := time.Parse("01-02-2006", i.maxTerminationDate) | ||
if err != nil { | ||
return nil, err | ||
return nil, fmt.Errorf("failed to parse max termination date: %s", err.Error()) | ||
} | ||
|
||
return &CalendarSettings{ | ||
MaxTerminationDate: t, | ||
MaxTerminationDate: maxTerminationDate, | ||
}, nil | ||
} |
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,38 @@ | ||
package config | ||
|
||
import ( | ||
"fmt" | ||
|
||
m "github.com/garrettladley/mattress" | ||
) | ||
|
||
type intermediateGoogleOAuthSettings struct { | ||
ClientID string `env:"CLIENT_ID"` | ||
ClientSecret string `env:"CLIENT_SECRET"` | ||
RedirectURI string `env:"REDIRECT_URI"` | ||
} | ||
|
||
func (i *intermediateGoogleOAuthSettings) into() (*OAuthSettings, error) { | ||
secretClientID, err := m.NewSecret(i.ClientID) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to create secret from client ID: %s", err.Error()) | ||
} | ||
|
||
secretClientSecret, err := m.NewSecret(i.ClientSecret) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to create secret from client secret: %s", err.Error()) | ||
} | ||
|
||
return &OAuthSettings{ | ||
BaseURL: "https://accounts.google.com/o/oauth2/v2", | ||
TokenURL: "https://oauth2.googleapis.com", | ||
ClientID: secretClientID, | ||
ClientSecret: secretClientSecret, | ||
Scopes: "https://www.googleapis.com/auth/calendar.events https://www.googleapis.com/auth/calendar.readonly", | ||
ResponseType: "code", | ||
RedirectURI: i.RedirectURI, | ||
IncludeGrantedScopes: "true", | ||
AccessType: "offline", | ||
Prompt: "consent", | ||
}, nil | ||
} |
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,37 @@ | ||
package config | ||
|
||
import ( | ||
"fmt" | ||
|
||
m "github.com/garrettladley/mattress" | ||
) | ||
|
||
type intermdeiateOutlookOAuthSettings struct { | ||
ClientID string `env:"CLIENT_ID"` | ||
ClientSecret string `env:"CLIENT_SECRET"` | ||
RedirectURI string `env:"REDIRECT_URI"` | ||
} | ||
|
||
func (i *intermdeiateOutlookOAuthSettings) into() (*OAuthSettings, error) { | ||
secretClientID, err := m.NewSecret(i.ClientID) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to create secret from client ID: %s", err.Error()) | ||
} | ||
|
||
secretClientSecret, err := m.NewSecret(i.ClientSecret) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to create secret from client secret: %s", err.Error()) | ||
} | ||
|
||
return &OAuthSettings{ | ||
BaseURL: "https://login.microsoftonline.com/common/oauth2/v2.0", | ||
TokenURL: "https://login.microsoftonline.com/common/oauth2/v2.0", | ||
ClientID: secretClientID, | ||
ClientSecret: secretClientSecret, | ||
Scopes: "offline_access user.read calendars.readwrite", | ||
ResponseType: "code", | ||
RedirectURI: i.RedirectURI, | ||
ResponseMode: "query", | ||
Prompt: "consent", | ||
}, nil | ||
} |
Oops, something went wrong.