-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from wttech/custom-password
Instance custom passwords PoC
- Loading branch information
Showing
26 changed files
with
562 additions
and
200 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 was deleted.
Oops, something went wrong.
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,42 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
"github.com/wttech/aemc/pkg/cfg" | ||
"github.com/wttech/aemc/pkg/common" | ||
"strings" | ||
) | ||
|
||
func (c *CLI) initCmd() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "initialize", | ||
Aliases: []string{"init"}, | ||
Short: "Initializes configuration and dependencies", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
if !c.config.IsInitialized() { | ||
if err := c.config.Initialize(); err != nil { | ||
c.Error(err) | ||
return | ||
} | ||
} | ||
c.SetOutput("gettingStarted", strings.Join([]string{ | ||
"The next step is providing AEM files (JAR or SDK ZIP, license) to directory '" + common.LibDir + "'.", | ||
"Alternatively, instruct the tool where these files are located by adjusting properties: 'dist_file', 'license_file' in configuration file '" + cfg.FileDefault + "'.", | ||
"To avoid problems with IDE performance, make sure to exclude from indexing the directory '" + common.HomeDir + "'.", | ||
"Finally, use control scripts to manage AEM instances:", | ||
"", | ||
|
||
"sh aemw [setup|resetup|up|down|restart]", | ||
|
||
"", | ||
"It is also possible to run individual AEM Compose CLI commands separately.", | ||
"Discover available commands by running:", | ||
"", | ||
|
||
"sh aemw --help", | ||
}, "\n")) | ||
c.Ok("initialized properly") | ||
}, | ||
} | ||
return cmd | ||
} |
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 |
---|---|---|
@@ -1,6 +1,21 @@ | ||
package common | ||
|
||
const ( | ||
MainDir = "aem" | ||
HomeDir = MainDir + "/home" | ||
MainDir = "aem" | ||
HomeDirName = "home" | ||
HomeDir = MainDir + "/" + HomeDirName | ||
VarDirName = "var" | ||
VarDir = HomeDir + "/" + VarDirName | ||
ConfigDirName = "etc" | ||
ConfigDir = HomeDir + "/" + ConfigDirName | ||
LogDirName = "log" | ||
LogDir = VarDir + "/" + LogDirName | ||
ToolDirName = "opt" | ||
ToolDir = HomeDir + "/" + ToolDirName | ||
LibDirName = "lib" | ||
LibDir = HomeDir + "/" + LibDirName | ||
TmpDirName = "tmp" | ||
TmpDir = HomeDir + "/" + TmpDirName | ||
DefaultDirName = "default" | ||
DefaultDir = MainDir + "/" + DefaultDirName | ||
) |
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 cryptox | ||
|
||
import ( | ||
"crypto/aes" | ||
"crypto/sha256" | ||
"encoding/hex" | ||
"fmt" | ||
log "github.com/sirupsen/logrus" | ||
"io" | ||
) | ||
|
||
func EncryptString(key []byte, text string) string { | ||
c, err := aes.NewCipher(key) | ||
if err != nil { | ||
log.Fatalf("encryption key/salt is invalid: %s", err) | ||
} | ||
encrypted := make([]byte, len(text)) | ||
c.Encrypt(encrypted, []byte(text)) | ||
return hex.EncodeToString(encrypted) | ||
} | ||
|
||
func DecryptString(key []byte, encrypted string) string { | ||
c, err := aes.NewCipher(key) | ||
if err != nil { | ||
log.Fatalf("decryption key/salt is invalid: %s", err) | ||
} | ||
decoded, _ := hex.DecodeString(encrypted) | ||
dest := make([]byte, len(decoded)) | ||
c.Decrypt(dest, decoded) | ||
s := string(dest[:]) | ||
return s | ||
} | ||
|
||
func HashString(text string) string { | ||
hash := sha256.New() | ||
_, _ = io.WriteString(hash, text) | ||
return fmt.Sprintf("%x", hash.Sum(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
Oops, something went wrong.