-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Galadriel Server Admin CLI - GLCP-39474 #164
Merged
Merged
Changes from 17 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
00f12a9
Adding methods to the CLI
mgbcaio 3c13f1c
Merge branch 'main' of https://github.com/mgbcaio/galadriel
mgbcaio e635754
merge main
mgbcaio c399781
updating CLI to use the new generated API spec
mgbcaio f473fa2
Merge branch 'main' of https://github.com/mgbcaio/galadriel
mgbcaio 4a3a62b
merge main
mgbcaio 7ba186e
adding create comand and generate jointoken
mgbcaio 8500f25
Merge branch 'main' of https://github.com/mgbcaio/galadriel
mgbcaio ab7fb61
Merge branch 'main' into server-admin-cli
mgbcaio b243a67
changing order of instantiation
mgbcaio 36aeff0
using api models for type
mgbcaio 0db62d9
decapitalize trust domain flag
mgbcaio bb82190
renaming management to admin
mgbcaio 5ca38bd
fixing duplication messages
mgbcaio 53b668d
removing unused var
mgbcaio 2283c37
fixing unit tests
mgbcaio d7015ee
trying to fix code duplication
mgbcaio 4ea8590
Merge branch 'main' into server-admin-cli
82f8223
Merge branch 'server-admin-cli' of https://github.com/mgbcaio/galadri…
mgbcaio d1f309f
address PR comments
mgbcaio 4c49629
Merge branch 'main' into server-admin-cli
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package cli | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/spf13/cobra" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestTokenCmd(t *testing.T) { | ||
cmd := &cobra.Command{} | ||
cmd.Flags().String("trustDomain", "test.com", "") | ||
|
||
err := cmd.Execute() | ||
|
||
assert.Nil(t, err) | ||
} |
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 +1,45 @@ | ||
package cli | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
|
||
"github.com/spf13/cobra" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestLoadConfig(t *testing.T) { | ||
tempFile, err := os.CreateTemp("", "server.conf") | ||
assert.NoError(t, err) | ||
defer os.Remove(tempFile.Name()) | ||
|
||
_, err = tempFile.WriteString(` | ||
server { | ||
listen_address = "localhost" | ||
listen_port = "8085" | ||
socket_path = "/tmp/galadriel-server/api.sock/" | ||
log_level = "DEBUG" | ||
} | ||
providers { | ||
Datastore "postgres" { | ||
connection_string = "postgresql://postgres:postgres@localhost:5432/galadriel" | ||
} | ||
|
||
X509CA "disk" { | ||
key_file_path = "./conf/server/dummy_root_ca.key" | ||
cert_file_path = "./conf/server/dummy_root_ca.crt" | ||
} | ||
|
||
KeyManager "memory" {} | ||
} | ||
`) | ||
assert.NoError(t, err) | ||
|
||
cmd := &cobra.Command{} | ||
cmd.Flags().String("config", tempFile.Name(), "") | ||
|
||
config, err := LoadConfig(cmd) | ||
|
||
assert.NoError(t, err) | ||
assert.NotNil(t, config) | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove all the commented code