mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-30 23:22:26 -05:00 
			
		
		
		
	Implement Cobra CLI tooling, Viper config tooling (#336)
* start pulling out + replacing urfave and config * replace many many instances of config * move more stuff => viper * properly remove urfave * move some flags to root command * add testrig commands to root * alias config file keys * start adding cli parsing tests * reorder viper init * remove config path alias * fmt * change config file keys to non-nested * we're more or less in business now * tidy up the common func * go fmt * get tests passing again * add note about the cliparsing tests * reorganize * update docs with changes * structure cmd dir better * rename + move some files around * fix dangling comma
This commit is contained in:
		
					parent
					
						
							
								182b4eea73
							
						
					
				
			
			
				commit
				
					
						0884f89431
					
				
			
		
					 487 changed files with 46667 additions and 8831 deletions
				
			
		|  | @ -25,6 +25,7 @@ import ( | |||
| 
 | ||||
| 	"codeberg.org/gruf/go-store/kv" | ||||
| 	"github.com/gin-gonic/gin" | ||||
| 	"github.com/spf13/viper" | ||||
| 	"github.com/stretchr/testify/suite" | ||||
| 	"github.com/superseriousbusiness/gotosocial/internal/api/client/followrequest" | ||||
| 	"github.com/superseriousbusiness/gotosocial/internal/config" | ||||
|  | @ -39,7 +40,6 @@ import ( | |||
| 
 | ||||
| type FollowRequestStandardTestSuite struct { | ||||
| 	suite.Suite | ||||
| 	config      *config.Config | ||||
| 	db          db.DB | ||||
| 	storage     *kv.KVStore | ||||
| 	federator   federation.Federator | ||||
|  | @ -70,14 +70,14 @@ func (suite *FollowRequestStandardTestSuite) SetupSuite() { | |||
| } | ||||
| 
 | ||||
| func (suite *FollowRequestStandardTestSuite) SetupTest() { | ||||
| 	testrig.InitTestConfig() | ||||
| 	testrig.InitTestLog() | ||||
| 	suite.config = testrig.NewTestConfig() | ||||
| 	suite.db = testrig.NewTestDB() | ||||
| 	suite.storage = testrig.NewTestStorage() | ||||
| 	suite.federator = testrig.NewTestFederator(suite.db, testrig.NewTestTransportController(testrig.NewMockHTTPClient(nil), suite.db), suite.storage) | ||||
| 	suite.emailSender = testrig.NewEmailSender("../../../../web/template/", nil) | ||||
| 	suite.processor = testrig.NewTestProcessor(suite.db, suite.storage, suite.federator, suite.emailSender) | ||||
| 	suite.followRequestModule = followrequest.New(suite.config, suite.processor).(*followrequest.Module) | ||||
| 	suite.followRequestModule = followrequest.New(suite.processor).(*followrequest.Module) | ||||
| 	testrig.StandardDBSetup(suite.db, nil) | ||||
| 	testrig.StandardStorageSetup(suite.storage, "../../../../testrig/media") | ||||
| } | ||||
|  | @ -95,7 +95,10 @@ func (suite *FollowRequestStandardTestSuite) newContext(recorder *httptest.Respo | |||
| 	ctx.Set(oauth.SessionAuthorizedApplication, suite.testApplications["application_1"]) | ||||
| 	ctx.Set(oauth.SessionAuthorizedUser, suite.testUsers["local_account_1"]) | ||||
| 
 | ||||
| 	baseURI := fmt.Sprintf("%s://%s", suite.config.Protocol, suite.config.Host) | ||||
| 	protocol := viper.GetString(config.Keys.Protocol) | ||||
| 	host := viper.GetString(config.Keys.Host) | ||||
| 
 | ||||
| 	baseURI := fmt.Sprintf("%s://%s", protocol, host) | ||||
| 	requestURI := fmt.Sprintf("%s/%s", baseURI, requestPath) | ||||
| 
 | ||||
| 	ctx.Request = httptest.NewRequest(requestMethod, requestURI, bytes.NewReader(requestBody)) // the endpoint we're hitting | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue