2021-02-28 15:17:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/ * 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-01 15:41:43 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								   GoToSocial 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 18:42:19 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								   Copyright  ( C )  2021 - 2022  GoToSocial  Authors  admin @ gotosocial . org 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-28 15:17:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-03-01 15:41:43 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								   This  program  is  free  software :  you  can  redistribute  it  and / or  modify 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								   it  under  the  terms  of  the  GNU  Affero  General  Public  License  as  published  by 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								   the  Free  Software  Foundation ,  either  version  3  of  the  License ,  or 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								   ( at  your  option )  any  later  version . 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-28 15:17:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-03-01 15:41:43 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								   This  program  is  distributed  in  the  hope  that  it  will  be  useful , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								   but  WITHOUT  ANY  WARRANTY ;  without  even  the  implied  warranty  of 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								   MERCHANTABILITY  or  FITNESS  FOR  A  PARTICULAR  PURPOSE .   See  the 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								   GNU  Affero  General  Public  License  for  more  details . 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-28 15:17:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-03-01 15:41:43 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								   You  should  have  received  a  copy  of  the  GNU  Affero  General  Public  License 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								   along  with  this  program .   If  not ,  see  < http : //www.gnu.org/licenses/>. 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-28 15:17:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								* / 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-02-27 22:57:50 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								package  main 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								import  ( 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-02 22:52:31 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									"github.com/sirupsen/logrus" 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-07 13:31:39 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									"github.com/spf13/cobra" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									"github.com/spf13/viper" 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-03 11:28:28 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-07 13:31:39 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									"github.com/superseriousbusiness/gotosocial/cmd/gotosocial/flag" 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-31 17:49:59 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									_  "github.com/superseriousbusiness/gotosocial/docs" 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-07 13:31:39 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									"github.com/superseriousbusiness/gotosocial/internal/config" 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-27 22:57:50 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-07 13:31:39 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								// Version is the software version of GtS being used. 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-28 12:17:20 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								var  Version  string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-07 13:31:39 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								// Commit is the git commit of GtS being used. 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-28 12:17:20 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								var  Commit  string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-07-31 17:49:59 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								//go:generate swagger generate spec 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-27 22:57:50 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								func  main ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-23 10:36:28 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									var  v  string 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-07 13:31:39 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  len ( Commit )  <  7  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-23 10:36:28 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										v  =  Version 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										v  =  Version  +  " "  +  Commit [ : 7 ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-09 11:25:13 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-07 13:31:39 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// override software version in viper store 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									viper . Set ( config . Keys . SoftwareVersion ,  v ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									// instantiate the root command 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									rootCmd  :=  & cobra . Command { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										Use :            "gotosocial" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										Short :          "GoToSocial - a fediverse social media server" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										Long :           "GoToSocial - a fediverse social media server\n\nFor help, see: https://docs.gotosocial.org.\n\nCode: https://github.com/superseriousbusiness/gotosocial" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										Version :        v , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										SilenceErrors :  true , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										SilenceUsage :   true , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									// attach global flags to the root command so that they can be accessed from any subcommand 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									flag . Global ( rootCmd ,  config . Defaults ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									// bind the config-path flag to viper early so that we can call it in the pre-run of following commands 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  err  :=  viper . BindPFlag ( config . Keys . ConfigPath ,  rootCmd . PersistentFlags ( ) . Lookup ( config . Keys . ConfigPath ) ) ;  err  !=  nil  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										logrus . Fatalf ( "error attaching config flag: %s" ,  err ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-02 22:52:31 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-07 13:31:39 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// add subcommands 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									rootCmd . AddCommand ( serverCommands ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									rootCmd . AddCommand ( testrigCommands ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									rootCmd . AddCommand ( debugCommands ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									rootCmd . AddCommand ( adminCommands ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									// run 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  err  :=  rootCmd . Execute ( ) ;  err  !=  nil  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										logrus . Fatalf ( "error executing command: %s" ,  err ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-02 22:52:31 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-27 22:57:50 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								}