MCPcopy Create free account
hub / github.com/firebase/firebase-tools / askQuestions

Function askQuestions

src/init/features/database.ts:136–169  ·  view source on GitHub ↗
(setup: Setup, config: Config)

Source from the content-addressed store, hash-verified

134 * @param config legacy config parameter. not used for database setup.
135 */
136export async function askQuestions(setup: Setup, config: Config): Promise<void> {
137 logger.info();
138 logger.info(
139 "Firebase Realtime Database Security Rules allow you to define how your data should be",
140 );
141 logger.info("structured and when your data can be read from and written to.");
142 logger.info();
143
144 const rulesFilename = await input({
145 message: "What file should be used for Realtime Database Security Rules?",
146 default: DEFAULT_RULES_FILENAME,
147 });
148 if (!rulesFilename) {
149 throw new FirebaseError("Must specify location for Realtime Database rules file.");
150 }
151 const info: RequiredInfo = {
152 rulesFilename,
153 rules: DEFAULT_RULES,
154 writeRules: true,
155 };
156 if (setup.projectId) {
157 const instanceDetails = await initializeDatabaseInstance(setup.projectId);
158 if (instanceDetails) {
159 info.rules = await getDBRules(instanceDetails);
160 utils.logBullet(
161 `Downloaded the existing Realtime Database Security Rules of database ${clc.bold(instanceDetails.name)} from the Firebase console`,
162 );
163 }
164 }
165 info.writeRules = await config.confirmWriteProjectFile(rulesFilename, info.rules);
166 // Populate featureInfo for the actuate step later.
167 setup.featureInfo = setup.featureInfo || {};
168 setup.featureInfo.database = info;
169}
170
171export async function actuate(setup: Setup, config: Config): Promise<void> {
172 const info = setup.featureInfo?.database;

Callers

nothing calls this directly

Calls 4

inputFunction · 0.90
getDBRulesFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…