@@ -95,6 +95,7 @@ type DeployOptions struct {
9595 files * deployFiles
9696 functions * deployFiles
9797 functionSchedules []* models.FunctionSchedule
98+ functionsConfig map [string ]models.FunctionConfig
9899}
99100
100101type uploadError struct {
@@ -225,7 +226,7 @@ func (n *Netlify) DoDeploy(ctx context.Context, options *DeployOptions, deploy *
225226
226227 options .files = files
227228
228- functions , schedules , err := bundle (ctx , options .FunctionsDir , options .Observer )
229+ functions , schedules , functionsConfig , err := bundle (ctx , options .FunctionsDir , options .Observer )
229230 if err != nil {
230231 if options .Observer != nil {
231232 options .Observer .OnFailedWalk ()
@@ -234,6 +235,7 @@ func (n *Netlify) DoDeploy(ctx context.Context, options *DeployOptions, deploy *
234235 }
235236 options .functions = functions
236237 options .functionSchedules = schedules
238+ options .functionsConfig = functionsConfig
237239
238240 deployFiles := & models.DeployFiles {
239241 Files : options .files .Sums ,
@@ -255,11 +257,16 @@ func (n *Netlify) DoDeploy(ctx context.Context, options *DeployOptions, deploy *
255257 deployFiles .FunctionSchedules = schedules
256258 }
257259
260+ if options .functionsConfig != nil {
261+ deployFiles .FunctionsConfig = options .functionsConfig
262+ }
263+
258264 l := context .GetLogger (ctx )
259265 l .WithFields (logrus.Fields {
260266 "site_id" : options .SiteID ,
261267 "deploy_files" : len (options .files .Sums ),
262268 "scheduled_functions" : len (schedules ),
269+ "functions_config" : functionsConfig ,
263270 }).Debug ("Starting to deploy files" )
264271 authInfo := context .GetAuthInfo (ctx )
265272
@@ -649,9 +656,9 @@ func addEdgeFunctionsToDeployFiles(dir string, files *deployFiles, observer Depl
649656 })
650657}
651658
652- func bundle (ctx context.Context , functionDir string , observer DeployObserver ) (* deployFiles , []* models.FunctionSchedule , error ) {
659+ func bundle (ctx context.Context , functionDir string , observer DeployObserver ) (* deployFiles , []* models.FunctionSchedule , map [ string ]models. FunctionConfig , error ) {
653660 if functionDir == "" {
654- return nil , nil , nil
661+ return nil , nil , nil , nil
655662 }
656663
657664 manifestFile , err := os .Open (filepath .Join (functionDir , "manifest.json" ))
@@ -668,7 +675,7 @@ func bundle(ctx context.Context, functionDir string, observer DeployObserver) (*
668675
669676 info , err := ioutil .ReadDir (functionDir )
670677 if err != nil {
671- return nil , nil , err
678+ return nil , nil , nil , err
672679 }
673680
674681 for _ , i := range info {
@@ -678,23 +685,23 @@ func bundle(ctx context.Context, functionDir string, observer DeployObserver) (*
678685 case zipFile (i ):
679686 runtime , err := readZipRuntime (filePath )
680687 if err != nil {
681- return nil , nil , err
688+ return nil , nil , nil , err
682689 }
683690 file , err := newFunctionFile (filePath , i , runtime , observer )
684691 if err != nil {
685- return nil , nil , err
692+ return nil , nil , nil , err
686693 }
687694 functions .Add (file .Name , file )
688695 case jsFile (i ):
689696 file , err := newFunctionFile (filePath , i , jsRuntime , observer )
690697 if err != nil {
691- return nil , nil , err
698+ return nil , nil , nil , err
692699 }
693700 functions .Add (file .Name , file )
694701 case goFile (filePath , i , observer ):
695702 file , err := newFunctionFile (filePath , i , goRuntime , observer )
696703 if err != nil {
697- return nil , nil , err
704+ return nil , nil , nil , err
698705 }
699706 functions .Add (file .Name , file )
700707 default :
@@ -704,14 +711,14 @@ func bundle(ctx context.Context, functionDir string, observer DeployObserver) (*
704711 }
705712 }
706713
707- return functions , nil , nil
714+ return functions , nil , nil , nil
708715}
709716
710- func bundleFromManifest (ctx context.Context , manifestFile * os.File , observer DeployObserver ) (* deployFiles , []* models.FunctionSchedule , error ) {
717+ func bundleFromManifest (ctx context.Context , manifestFile * os.File , observer DeployObserver ) (* deployFiles , []* models.FunctionSchedule , map [ string ]models. FunctionConfig , error ) {
711718 manifestBytes , err := ioutil .ReadAll (manifestFile )
712719
713720 if err != nil {
714- return nil , nil , err
721+ return nil , nil , nil , err
715722 }
716723
717724 logger := context .GetLogger (ctx )
@@ -722,23 +729,24 @@ func bundleFromManifest(ctx context.Context, manifestFile *os.File, observer Dep
722729 err = json .Unmarshal (manifestBytes , & manifest )
723730
724731 if err != nil {
725- return nil , nil , fmt .Errorf ("malformed functions manifest file: %w" , err )
732+ return nil , nil , nil , fmt .Errorf ("malformed functions manifest file: %w" , err )
726733 }
727734
728735 schedules := make ([]* models.FunctionSchedule , 0 , len (manifest .Functions ))
729736 functions := newDeployFiles ()
737+ functionsConfig := make (map [string ]models.FunctionConfig )
730738
731739 for _ , function := range manifest .Functions {
732740 fileInfo , err := os .Stat (function .Path )
733741
734742 if err != nil {
735- return nil , nil , fmt .Errorf ("manifest file specifies a function path that cannot be found: %s" , function .Path )
743+ return nil , nil , nil , fmt .Errorf ("manifest file specifies a function path that cannot be found: %s" , function .Path )
736744 }
737745
738746 file , err := newFunctionFile (function .Path , fileInfo , function .Runtime , observer )
739747
740748 if err != nil {
741- return nil , nil , err
749+ return nil , nil , nil , err
742750 }
743751
744752 if function .Schedule != "" {
@@ -748,10 +756,16 @@ func bundleFromManifest(ctx context.Context, manifestFile *os.File, observer Dep
748756 })
749757 }
750758
759+ if function .DisplayName != "" {
760+ functionsConfig [file .Name ] = models.FunctionConfig {
761+ DisplayName : function .DisplayName ,
762+ }
763+ }
764+
751765 functions .Add (file .Name , file )
752766 }
753767
754- return functions , schedules , nil
768+ return functions , schedules , functionsConfig , nil
755769}
756770
757771func readZipRuntime (filePath string ) (string , error ) {
0 commit comments