Skip to content

configuration values configured for a deployment ignored in function call #50

@mklaehn

Description

@mklaehn

Having

package com.example.fn;

import com.fnproject.fn.api.FnConfiguration;
import com.fnproject.fn.api.RuntimeContext;

public class PojoFunction {

    private String greeting;

    @FnConfiguration
    public void setUp(RuntimeContext ctx) {
        greeting = ctx.getConfigurationByKey("GREETING").orElse("Hello");
    }

    public Object greet(String name) {
        if (name == null || name.isEmpty()) {
            name = "World";
        }
//        System.out.println(name);
        return new Greeting(greeting, name);
    }

    public static class Greeting {

        public final String name;
        public final String salutation;

        public Greeting(String salutation, String name) {
            this.salutation = salutation;
            this.name = name;
        }
    }
}

and deploying PojoFunction to Fn Server allows PojoFunction to be seen in a running fn-ui container.
It is then possible to add Configurations for PojoFunction by executing the Edit button for that deployment.

There's several problems with this.

  1. already configured config values are not shown
  2. configuration values added here are of no relevance to a fn call execution. i.e. the value are ignored

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions