Fix merge conflicts

This commit is contained in:
Tuan Dang
2023-12-12 15:50:14 +07:00
5 changed files with 31 additions and 27 deletions

View File

@@ -53,13 +53,13 @@ const identityAccessTokenSchema = new Schema(
accessTokenTTL: { // seconds
// incremental lifetime
type: Number,
default: 7200,
default: 2592000, // 30 days
required: true
},
accessTokenMaxTTL: { // seconds
// max lifetime
type: Number,
default: 7200,
default: 2592000, // 30 days
required: true
},
accessTokenTrustedIps: {

View File

@@ -117,7 +117,9 @@ export const AddUniversalAuthToIdentityV1 = z.object({
.min(1)
.default([{ ipAddress: "0.0.0.0/0" }]),
accessTokenTTL: z.number().int().min(0).default(7200),
accessTokenMaxTTL: z.number().int().min(0).default(2592000),
accessTokenMaxTTL: z.number().int().refine(value => value !== 0, {
message: "accessTokenMaxTTL must have a non zero number",
}).default(2592000), // 30 days
accessTokenNumUsesLimit: z.number().int().min(0).default(0)
})
});
@@ -143,7 +145,9 @@ export const UpdateUniversalAuthToIdentityV1 = z.object({
.optional(),
accessTokenTTL: z.number().int().min(0).optional(),
accessTokenNumUsesLimit: z.number().int().min(0).optional(),
accessTokenMaxTTL: z.number().int().min(0).optional(),
accessTokenMaxTTL: z.number().int().refine(value => value !== 0, {
message: "accessTokenMaxTTL must have a non zero number",
}).optional(),
}),
});

View File

@@ -204,7 +204,8 @@ func init() {
func executeSingleCommandWithEnvs(args []string, secretsCount int, env []string) error {
command := args[0]
argsForCommand := args[1:]
color.Green("Injecting %v Infisical secrets into your application process", secretsCount)
log.Info().Msgf(color.GreenString("Injecting %v Infisical secrets into your application process", secretsCount))
cmd := exec.Command(command, argsForCommand...)
cmd.Stdin = os.Stdin
@@ -232,7 +233,7 @@ func executeMultipleCommandWithEnvs(fullCommand string, secretsCount int, env []
cmd.Stderr = os.Stderr
cmd.Env = env
color.Green("Injecting %v Infisical secrets into your application process", secretsCount)
log.Info().Msgf(color.GreenString("Injecting %v Infisical secrets into your application process", secretsCount))
log.Debug().Msgf("executing command: %s %s %s \n", shell[0], shell[1], fullCommand)
return execCmd(cmd)

View File

@@ -11,7 +11,6 @@ import (
"os/exec"
"runtime"
"strings"
"time"
"github.com/fatih/color"
"github.com/rs/zerolog/log"
@@ -21,16 +20,16 @@ func CheckForUpdate() {
if checkEnv := os.Getenv("INFISICAL_DISABLE_UPDATE_CHECK"); checkEnv != "" {
return
}
latestVersion, publishedDate, err := getLatestTag("Infisical", "infisical")
latestVersion, _, err := getLatestTag("Infisical", "infisical")
if err != nil {
log.Debug().Err(err)
// do nothing and continue
return
}
daysSinceRelease, _ := daysSinceDate(publishedDate)
// daysSinceRelease, _ := daysSinceDate(publishedDate)
if latestVersion != CLI_VERSION && daysSinceRelease > 2 {
if latestVersion != CLI_VERSION {
yellow := color.New(color.FgYellow).SprintFunc()
blue := color.New(color.FgCyan).SprintFunc()
black := color.New(color.FgBlack).SprintFunc()
@@ -151,15 +150,15 @@ func IsRunningInDocker() bool {
return strings.Contains(string(cgroup), "docker")
}
func daysSinceDate(dateString string) (int, error) {
layout := "2006-01-02T15:04:05Z"
parsedDate, err := time.Parse(layout, dateString)
if err != nil {
return 0, err
}
// func daysSinceDate(dateString string) (int, error) {
// layout := "2006-01-02T15:04:05Z"
// parsedDate, err := time.Parse(layout, dateString)
// if err != nil {
// return 0, err
// }
currentTime := time.Now()
difference := currentTime.Sub(parsedDate)
days := int(difference.Hours() / 24)
return days, nil
}
// currentTime := time.Now()
// difference := currentTime.Sub(parsedDate)
// days := int(difference.Hours() / 24)
// return days, nil
// }

View File

@@ -89,7 +89,7 @@ export const IdentityUniversalAuthForm = ({
resolver: yupResolver(schema),
defaultValues: {
accessTokenTTL: "7200",
accessTokenMaxTTL: "0",
accessTokenMaxTTL: "2592000",
accessTokenNumUsesLimit: "0",
clientSecretTrustedIps: [{
ipAddress: "0.0.0.0/0"
@@ -112,7 +112,7 @@ export const IdentityUniversalAuthForm = ({
} = useFieldArray({ control, name: "accessTokenTrustedIps" });
useEffect(() => {
if (data) { // TODO: fix data type
if (data) {
reset({
accessTokenTTL: String(data.accessTokenTTL),
accessTokenMaxTTL: String(data.accessTokenMaxTTL),
@@ -137,7 +137,7 @@ export const IdentityUniversalAuthForm = ({
} else {
reset({
accessTokenTTL: "7200",
accessTokenMaxTTL: "7200",
accessTokenMaxTTL: "2592000",
accessTokenNumUsesLimit: "0",
clientSecretTrustedIps: [{
ipAddress: "0.0.0.0/0"
@@ -231,7 +231,7 @@ export const IdentityUniversalAuthForm = ({
/>
<Controller
control={control}
defaultValue="7200"
defaultValue="2592000"
name="accessTokenMaxTTL"
render={({ field, fieldState: { error } }) => (
<FormControl
@@ -241,9 +241,9 @@ export const IdentityUniversalAuthForm = ({
>
<Input
{...field}
placeholder="7200"
placeholder="2592000"
type="number"
min="0"
min="1"
step="1"
/>
</FormControl>