Skip to content

Commit c69346a

Browse files
committed
Add FAQ entry on the config file
1 parent 5651201 commit c69346a

File tree

4 files changed

+31
-9
lines changed

4 files changed

+31
-9
lines changed

doc/FAQ.md

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
- [How does code-server decide what workspace or folder to open?](#how-does-code-server-decide-what-workspace-or-folder-to-open)
1818
- [How do I debug issues with code-server?](#how-do-i-debug-issues-with-code-server)
1919
- [Heartbeat file](#heartbeat-file)
20+
- [How does the config file work?](#how-does-the-config-file-work)
2021
- [Enterprise](#enterprise)
2122

2223
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
@@ -55,7 +56,7 @@ Feel free to file an issue to add a missing extension to the marketplace.
5556
Defaults to `~/.local/share/code-server/extensions`.
5657

5758
If the `XDG_DATA_HOME` environment variable is set the data directory will be
58-
`$XDG_DATA_HOME/code-server/extensions`.
59+
`$XDG_DATA_HOME/code-server/extensions`. In general we try to follow the XDG directory spec.
5960

6061
You can install an extension on the CLI with:
6162

@@ -184,9 +185,8 @@ code-server --log debug
184185
Once this is done, replicate the issue you're having then collect logging
185186
information from the following places:
186187

187-
1. stdout.
188-
2. The most recently created directory in the `logs` directory (found in the
189-
data directory; see below for how to find that).
188+
1. stdout
189+
2. The most recently created directory in the `~/.local/share/code-server/logs` directory
190190
3. The browser console and network tabs.
191191

192192
Additionally, collecting core dumps (you may need to enable them first) if
@@ -198,11 +198,31 @@ code-server crashes can be helpful.
198198
as there is an active browser connection.
199199

200200
If you want to shutdown `code-server` if there hasn't been an active connection in X minutes
201-
you can do so by continously checking the last modified time on the heartbeat file and if it is
201+
you can do so by continuously checking the last modified time on the heartbeat file and if it is
202202
older than X minutes, you should kill `code-server`.
203203

204204
[#1636](https://github.com/cdr/code-server/issues/1636) will make the experience here better.
205205

206+
## How does the config file work?
207+
208+
When `code-server` starts up, it creates a default config file in `~/.config/code-server/config.yaml` that looks
209+
like this:
210+
211+
```yaml
212+
bind-addr: 127.0.0.1:8080
213+
auth: password
214+
password: mewkmdasosafuio3422 # This is randomly generated for each config.yaml
215+
cert: false
216+
```
217+
218+
Each key in the file maps directly to a `code-server` flag. Run `code-server --help` to see
219+
a listing of all the flags.
220+
221+
The default config here says to listen on the loopback IP port 8080, enable password authorization
222+
and no TLS. Any flags passed to `code-server` will take priority over the config file.
223+
224+
The `--config` flag or `$CODE_SERVER_CONFIG` can be used to change the config file's location.
225+
206226
## Enterprise
207227

208228
Visit [our enterprise page](https://coder.com) for more information about our

doc/guide.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,8 @@ Visit `https://<your-instance-ip>` to access code-server.
218218
You'll get a warning when accessing but if you click through you should be good.
219219

220220
You can also use [mkcert](https://mkcert.dev) to create a self signed certificate trusted by your
221-
OS to avoid the warnings.
221+
OS to avoid the warnings and then pass it to code-server via the `cert` and `cert-key` config
222+
fields.
222223

223224
### Change the password?
224225

src/node/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ export async function readConfigFile(configPath?: string): Promise<Args> {
338338
logger.info(`Wrote default config file to ${humanPath(configPath)}`)
339339
}
340340

341-
logger.info(`Using config file from ${humanPath(configPath)}`)
341+
logger.info(`Using config file ${humanPath(configPath)}`)
342342

343343
const configFile = await fs.readFile(configPath)
344344
const config = yaml.safeLoad(configFile.toString(), {

src/node/entry.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ const main = async (cliArgs: Args): Promise<void> => {
4343
}
4444
}
4545

46-
logger.trace(`Using extensions-dir at ${humanPath(args["extensions-dir"])}`)
47-
logger.trace(`Using user-data-dir at ${humanPath(args["user-data-dir"])}`)
46+
logger.info(`Using user-data-dir ${humanPath(args["user-data-dir"])}`)
47+
48+
logger.trace(`Using extensions-dir ${humanPath(args["extensions-dir"])}`)
4849

4950
const envPassword = !!process.env.PASSWORD
5051
const password = args.auth === AuthType.Password && (process.env.PASSWORD || args.password)

0 commit comments

Comments
 (0)