File tree Expand file tree Collapse file tree
stripe/src/main/java/org/restheart/stripe Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -171,7 +171,23 @@ public void initProducts(String dbName) {
171171 initProducts (dbName , conf .products ());
172172 }
173173
174- private void initProducts (String dbName , ProductsConfig products ) {
174+ /**
175+ * Initializes the products mode domain model on {@code dbName} using the given configuration
176+ * instead of the statically configured one.
177+ *
178+ * <p>This is the overload a multi-tenant deployment needs. {@link #initProducts(String)} reads
179+ * collection names from {@code stripeConfig.products}, which on a node serving many tenants is
180+ * either absent or belongs to no tenant in particular — initializing from it would create the
181+ * wrong collections, and leave the ones the tenant actually configured missing. Pass the
182+ * tenant's own {@code ProductsConfig} (RESTHeart Cloud takes it from
183+ * {@code override-stripe-products}) so that what gets created is what that tenant will read
184+ * and write.
185+ *
186+ * @param dbName the database name to initialize
187+ * @param products the configuration to initialize from — collection names, and the inventory
188+ * collection when that tenant uses one
189+ */
190+ public void initProducts (String dbName , ProductsConfig products ) {
175191 var db = mclient .getDatabase (dbName );
176192
177193 LOGGER .info ("[stripe] initializing products mode on database '{}'" , dbName );
You can’t perform that action at this time.
0 commit comments