@@ -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,6 +257,10 @@ 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 ,
@@ -649,9 +655,9 @@ func addEdgeFunctionsToDeployFiles(dir string, files *deployFiles, observer Depl
649655 })
650656}
651657
652- func bundle (ctx context.Context , functionDir string , observer DeployObserver ) (* deployFiles , []* models.FunctionSchedule , error ) {
658+ func bundle (ctx context.Context , functionDir string , observer DeployObserver ) (* deployFiles , []* models.FunctionSchedule , map [ string ]models. FunctionConfig , error ) {
653659 if functionDir == "" {
654- return nil , nil , nil
660+ return nil , nil , nil , nil
655661 }
656662
657663 manifestFile , err := os .Open (filepath .Join (functionDir , "manifest.json" ))
@@ -668,7 +674,7 @@ func bundle(ctx context.Context, functionDir string, observer DeployObserver) (*
668674
669675 info , err := ioutil .ReadDir (functionDir )
670676 if err != nil {
671- return nil , nil , err
677+ return nil , nil , nil , err
672678 }
673679
674680 for _ , i := range info {
@@ -678,23 +684,23 @@ func bundle(ctx context.Context, functionDir string, observer DeployObserver) (*
678684 case zipFile (i ):
679685 runtime , err := readZipRuntime (filePath )
680686 if err != nil {
681- return nil , nil , err
687+ return nil , nil , nil , err
682688 }
683689 file , err := newFunctionFile (filePath , i , runtime , observer )
684690 if err != nil {
685- return nil , nil , err
691+ return nil , nil , nil , err
686692 }
687693 functions .Add (file .Name , file )
688694 case jsFile (i ):
689695 file , err := newFunctionFile (filePath , i , jsRuntime , observer )
690696 if err != nil {
691- return nil , nil , err
697+ return nil , nil , nil , err
692698 }
693699 functions .Add (file .Name , file )
694700 case goFile (filePath , i , observer ):
695701 file , err := newFunctionFile (filePath , i , goRuntime , observer )
696702 if err != nil {
697- return nil , nil , err
703+ return nil , nil , nil , err
698704 }
699705 functions .Add (file .Name , file )
700706 default :
@@ -704,14 +710,14 @@ func bundle(ctx context.Context, functionDir string, observer DeployObserver) (*
704710 }
705711 }
706712
707- return functions , nil , nil
713+ return functions , nil , nil , nil
708714}
709715
710- func bundleFromManifest (ctx context.Context , manifestFile * os.File , observer DeployObserver ) (* deployFiles , []* models.FunctionSchedule , error ) {
716+ func bundleFromManifest (ctx context.Context , manifestFile * os.File , observer DeployObserver ) (* deployFiles , []* models.FunctionSchedule , map [ string ]models. FunctionConfig , error ) {
711717 manifestBytes , err := ioutil .ReadAll (manifestFile )
712718
713719 if err != nil {
714- return nil , nil , err
720+ return nil , nil , nil , err
715721 }
716722
717723 logger := context .GetLogger (ctx )
@@ -722,23 +728,24 @@ func bundleFromManifest(ctx context.Context, manifestFile *os.File, observer Dep
722728 err = json .Unmarshal (manifestBytes , & manifest )
723729
724730 if err != nil {
725- return nil , nil , fmt .Errorf ("malformed functions manifest file: %w" , err )
731+ return nil , nil , nil , fmt .Errorf ("malformed functions manifest file: %w" , err )
726732 }
727733
728734 schedules := make ([]* models.FunctionSchedule , 0 , len (manifest .Functions ))
729735 functions := newDeployFiles ()
736+ functionsConfig := make (map [string ]models.FunctionConfig )
730737
731738 for _ , function := range manifest .Functions {
732739 fileInfo , err := os .Stat (function .Path )
733740
734741 if err != nil {
735- return nil , nil , fmt .Errorf ("manifest file specifies a function path that cannot be found: %s" , function .Path )
742+ return nil , nil , nil , fmt .Errorf ("manifest file specifies a function path that cannot be found: %s" , function .Path )
736743 }
737744
738745 file , err := newFunctionFile (function .Path , fileInfo , function .Runtime , observer )
739746
740747 if err != nil {
741- return nil , nil , err
748+ return nil , nil , nil , err
742749 }
743750
744751 if function .Schedule != "" {
@@ -748,10 +755,16 @@ func bundleFromManifest(ctx context.Context, manifestFile *os.File, observer Dep
748755 })
749756 }
750757
758+ if function .DisplayName != "" {
759+ functionsConfig [file .Name ] = models.FunctionConfig {
760+ DisplayName : function .DisplayName ,
761+ }
762+ }
763+
751764 functions .Add (file .Name , file )
752765 }
753766
754- return functions , schedules , nil
767+ return functions , schedules , functionsConfig , nil
755768}
756769
757770func readZipRuntime (filePath string ) (string , error ) {
0 commit comments